Skip to content
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

Import resolution problem #248

Closed
dant3 opened this issue Oct 7, 2015 · 1 comment
Closed

Import resolution problem #248

dant3 opened this issue Oct 7, 2015 · 1 comment
Labels

Comments

@dant3
Copy link
Contributor

dant3 commented Oct 7, 2015

Here is an example code that makes importing scala._ stuff impossible:

object importing_issue {
  object scala {
    def evilThing = ???
  }
}

import scala.concurrent.duration._
import importing_issue._
println("foo")

which results in:

Compilation Failed
Main.scala:49: value concurrent is not a member of object cmd1.importing_issue.scala
import scala.concurrent.duration.{
             ^
Main.scala:93: value None is not a member of object cmd1.importing_issue.scala
              .print(res3, res3, "res3", scala.None)
                                               ^

and makes your repl useless.

@lihaoyi
Copy link
Member

lihaoyi commented Nov 22, 2015

This is tricky; we could probably make it work by maintaining the previousImports map as ordered by insertion. We'd also need to keep multiple imports from the same namespace separate rather than collapsing them into the same import statement, to support cases like

import scala.concurrent
object import_issue{
  object scala{
    def evilThing = ???
  }
}
import importing_issue._
import scala.evilThing

Which will take some elbow-grease, but doesn't seem in-principle difficult

@lihaoyi lihaoyi added the bug label Dec 1, 2015
lihaoyi pushed a commit that referenced this issue Jan 31, 2016
…but a minor example seems to work with no regressions depite the significant refactorings.
@lihaoyi lihaoyi closed this as completed in 049d04a Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants