-
Notifications
You must be signed in to change notification settings - Fork 21
REPL ImportHandler is not tracking importedNames and importedSymbols correctly #9881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9881?orig=1 |
@som-snytt said (edited on Aug 7, 2016 5:59:03 PM UTC): Showing failure on rename. Works on regular module import. Also the failure on package import from the other ticket. $ scala -Yrepl-class-based
Welcome to Scala 2.12.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.
scala> object X { def x = 42 }
defined object X
scala> import X.{x => y}
import X.{x=>y}
scala> class C(i: Int = y)
<console>:11: error: not found: value y
class C(i: Int = y)
^
scala> class C ; y
<console>:13: error: not found: value y
y
^
scala> import X.x
import X.x
scala> class C(i: Int = x)
defined class C
scala> import concurrent.Future
import concurrent.Future
scala> class C(f: Future[Int])
<console>:11: error: not found: type Future
class C(f: Future[Int])
^
scala> def f: Future[Int] = ???
f: scala.concurrent.Future[Int]
|
@SethTisue said: |
@jasonxh said: |
@som-snytt said (edited on Aug 13, 2016 7:04:31 AM UTC): Apparently, I started looking at it but then forgot about it. retronym's link to WIP is probably still relevant. |
@som-snytt said: |
…lass constructors, extends clause ## What changes were proposed in this pull request? [SPARK-22393](https://issues.apache.org/jira/browse/SPARK-22393) ## How was this patch tested? With a new test case in `RepSuite` ---- This code is a retrofit of the Scala [SI-9881](scala/bug#9881) bug fix, which never made it into the Scala 2.11 branches. Pushing these changes directly to the Scala repo is not practical (see: scala/scala#6195). Author: Mark Petruska <petruska.mark@gmail.com> Closes #19846 from mpetruska/SPARK-22393.
2.11 fix for scala/bug#9881
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 returnsNoPrefix
. Should probably usesym.typeOfThis
instead.importableMembers
may not always be able to return complete list (the case I encountered was withscala.reflect.runtime.universe
which has a type ofscala.reflect.api.JavaUniverse
). Thus we probably should not restrictimportedNames
to onlyimportableMembers
for non-wildcard imports.typeOfExpression
inadvertently changing phase tojvm
.The text was updated successfully, but these errors were encountered: