Skip to content

REPL ImportHandler is not tracking importedNames and importedSymbols correctly #9881

@scabug

Description

@scabug

Under current implementation, both fields are mostly empty. An immediate consequence is :imports doesn't report anything. Also it causes problems to other components that rely on these fields, such as when defining classes in REPL with -Yrepl-class-based enabled. See issue [SI-9880].

There seem to be a few issues here:

  • sym.thisType on a module symbol always returns NoPrefix. Should probably use sym.typeOfThis instead.
  • It doesn't handle renames because it won't be able to find the renames in importable members.
  • importableMembers may not always be able to return complete list (the case I encountered was with scala.reflect.runtime.universe which has a type of scala.reflect.api.JavaUniverse). Thus we probably should not restrict importedNames to only importableMembers for non-wildcard imports.
  • This is caused by typeOfExpression inadvertently changing phase to jvm.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions