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

Illegal import rename of a wildcard #10641

Closed
gkossakowski opened this issue Dec 4, 2017 · 2 comments · Fixed by scala/scala#6218
Closed

Illegal import rename of a wildcard #10641

gkossakowski opened this issue Dec 4, 2017 · 2 comments · Fixed by scala/scala#6218

Comments

@gkossakowski
Copy link

gkossakowski commented Dec 4, 2017

scalac allows one to rename wildcard to an arbitrary identifier:

scala> object Foo { class A }
defined object Foo

scala> import Foo.{_ => Bla}
import Foo._

// A is available because the import is a wildcard one despite the rename!
scala> new A
res1: Foo.A = Foo$A@687a0e40

// Bla is not available
scala> new Bla
<console>:16: error: not found: type Bla
       new Bla

This should be ruled out by the parser. dottyc does rule it out at the parsing time.

Discovered while carefully reading the scala spec for the purpose of implementing import renames in Kentucky Mule: gkossakowski/kentuckymule#6 (comment)

@som-snytt
Copy link

Relates to #6426

@som-snytt
Copy link

You don't even need the braces:

scala> import collection._ => foo
import collection._

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants