Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-9881

REPL ImportHandler is not tracking importedNames and importedSymbols correctly

    Details

      Description

      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:

      1. sym.thisType on a module symbol always returns NoPrefix. Should probably use sym.typeOfThis instead.
      2. It doesn't handle renames because it won't be able to find the renames in importable members.
      3. 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jasonxh Hao Xia
                Reporter:
                jasonxh Hao Xia
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: