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

Private object member is importable inside function definition #3285

Closed
scabug opened this issue Apr 13, 2010 · 3 comments
Closed

Private object member is importable inside function definition #3285

scabug opened this issue Apr 13, 2010 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Apr 13, 2010

Using

Scala compiler version 2.8.0.r21376-b20100408020204 -- Copyright
2002-2010, LAMP/EPFL

I get an error when importing a private object member:

package z {
trait L {val x = 1}
object O {private val x = 2}

class C extends L {
 def f = {
 import O._
 println(x)
 }
}
}

test.scala:8: error: reference to x is ambiguous;
it is both defined in trait L and imported subsequently by
import O._
println(x)
^
one error found

Note if I move the import O._ outside the function f, everything compiles

@scabug
Copy link
Author

scabug commented Apr 13, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3285?orig=1
Reporter: Jeppe Nejsum Madsen (nejsum)

@scabug
Copy link
Author

scabug commented Apr 13, 2010

@paulp said:
It's almost a duplicate of #3160, but the overlap isn't 100%. I bet they'll share a commit though.

@scabug
Copy link
Author

scabug commented Apr 13, 2010

@paulp said:
Oh, it's totally a duplicate of #2133. I knew it was in there somewhere.

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

2 participants