Skip to content

Where do nested static module symbols go after flatten? #403

Open
@retronym

Description

@retronym
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)

package p1; object O1 { object O2 }

// Exiting paste mode, now interpreting.

scala> :power
Power mode enabled. :phase is at typer.
import scala.tools.nsc._, intp.global._, definitions._
Try :help or completions for vals._ and power._

scala> rootMirror.staticModule("p1.O1").moduleClass.info.decls
res0: $r.intp.global.Scope = Scopes.Scope(constructor O1, object O2)

scala> exitingFlatten(rootMirror.staticModule("p1.O1").moduleClass.info.decls)
res1: $r.intp.global.Scope = Scopes.Scope(constructor O1)

scala> exitingFlatten(rootMirror.staticPackage("p1").moduleClass.info.decls)
res2: $r.intp.global.Scope = Scopes.Scope(object O1)

scala> res0.lookup
lookup      lookupAllEntries   lookupEntry    lookupNameInSameScopeAs   lookupSymbolEntry
lookupAll   lookupClass        lookupModule   lookupNextEntry           lookupUnshadowedEntries

scala> res0.lookup(TermName("O2"))
res3: $r.intp.global.Symbol = object O2

scala> exitingFlatten(res3.name)
res4: res3.NameType = O1$O2

scala> exitingFlatten(res3.owner)
res5: $r.intp.global.Symbol = package p1

Why does the flatten info transform leave poor static module symbols in limbo? It seems that when we forget to call exitingPicker(classSym.companionModule), we end up either not seeing the companion, or seeing a companion based on a classfile from a previous run.

Follow up for #402

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions