We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Presentation compiler sometimes does not see imported symbols. For example, when I load following two files into the presentation compiler:
// Prestest.scala package prestest object Prestest { trait Root { def meth = 5 } }
// ops.scala package com.whatever //import prestest.Prestest.Root object Utils { import prestest.Prestest.Root implicit class rootOps(root: Root) { def implicitMethod: Int = 42 } }
I get the following error when typechecking the second file:
ops.scala:10: error: not found: type Root implicit class rootOps(root: Root) { ^
The problem disappears when I move the import statement outside of Utils object.
Utils
I did a git-bisect and found out that the regression was introduced in 7664e25eed8ae4547f1cfd774b62a7b6a4baf8b5 (fix for #8941).
git-bisect
Here's a full source of test case that I was running:
import scala.reflect.internal.util.BatchSourceFile import scala.tools.nsc.{interactive, Settings} import scala.tools.nsc.reporters.ConsoleReporter object Test { def main(args: Array[String]) { val settings = new Settings settings.usejavacp.value = true val reporter = new ConsoleReporter(settings) val iglobal = new interactive.Global(settings, reporter) import iglobal._ def getOrThrow[T](resp: Response[T]) = resp.get match { case Left(res) => res case Right(t) => throw t } def load(sourceFile: BatchSourceFile) = { val resp = new Response[Tree] askLoadedTyped(sourceFile, resp) getOrThrow(resp) } val prestestSrc = new BatchSourceFile("Prestest.scala", """ |package prestest | |object Prestest { | trait Root { | def meth = 5 | } |} | """.stripMargin ) load(prestestSrc) val opsSrc = new BatchSourceFile("ops.scala", """ |package com.whatever | |//import prestest.Prestest.Root | |object Utils { | | import prestest.Prestest.Root | | implicit class rootOps(root: Root) { | def implicitMethod: Int = 42 | } | |} """.stripMargin) load(opsSrc) if(reporter.hasErrors) { throw new Exception("There were errors") } } }
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-9283?orig=1 Reporter: @ghik Affected Versions: 2.11.5, 2.11.6 See #8941
Sorry, something went wrong.
retronym
No branches or pull requests
Presentation compiler sometimes does not see imported symbols. For example, when I load following two files into the presentation compiler:
I get the following error when typechecking the second file:
The problem disappears when I move the import statement outside of
Utils
object.I did a
git-bisect
and found out that the regression was introduced in 7664e25eed8ae4547f1cfd774b62a7b6a4baf8b5 (fix for #8941).Here's a full source of test case that I was running:
The text was updated successfully, but these errors were encountered: