Skip to content

Can't import package beginning with "util" #1583

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

Closed
Arthurm1 opened this issue Oct 11, 2016 · 3 comments
Closed

Can't import package beginning with "util" #1583

Arthurm1 opened this issue Oct 11, 2016 · 3 comments

Comments

@Arthurm1
Copy link

opening a new REPL and trying to import a package with name util.xxx.yyy gives an error...

scala> import util.foo.bar 
<console>:6: error: value foo is not a member of util.type
import util.foo.bar
            ^

The following gives no error even though "util.bar" doesn't exist...

scala> import util.bar 
import util.bar

using the following suggested by @felixmulder works...

import _root_.util.foo.bar
@odersky
Copy link
Contributor

odersky commented Oct 13, 2016

This looks like a duplicate of #1286, and I think #1479 will fix it. @nicolasstucki can you check?

@Arthurm1
Copy link
Author

I think my issue here is that every package within the scala package is available directly.
So this gives no error...

scala> val foo = util.Left  // shouldn't I have to specify scala.util.Left ?
foo: scala.util.Left$ = Left

This means I can't name any of my packages "util.foo.bar" because any attempt to import them gives...

scala> import util.foo.bar 
-- [E008] Member Not Found Error: <console> ----------------------------------------------------------------------------
4 |import util.foo.bar
  |       ^^^^^^^^
  |       value `foo` is not a member of util.type - did you mean `util.Left`?
scala>  

BTW - I like the new error reporting.

@felixmulder
Copy link
Contributor

Reported fixed in #1479 by @nicolasstucki

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 18, 2016
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 19, 2016
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants