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

Support Scala 3 wildcard and renaming imports under -Xsource:3 #9582

Merged
merged 1 commit into from Apr 20, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 19, 2021

Instead of:

import foo._

One can now write:

import foo.*

and instead of:

import foo.{bar => baz}

One can now write:

import foo.{bar as baz}

As well as:

import foo.bar as baz

This will let us deprecate the old syntax in a future release of Scala
3 (it's currently only deprecated under -source future).

See http://dotty.epfl.ch/docs/reference/changed-features/imports.html for
details but note that unlike Scala 3 this commit does not implement
support for:

import java as j

As that would require deeper changes in the compiler.

Instead of:

    import foo._

One can now write:

    import foo.*

and instead of:

    import foo.{bar => baz}

One can now write:

    import foo.{bar as baz}

As well as:

    import foo.bar as baz

This will let us deprecate the old syntax in a future release of Scala
3 (it's currently only deprecated under `-source future`).

See http://dotty.epfl.ch/docs/reference/changed-features/imports.html
for details but note that unlike Scala 3 this commit does not implement
support for:

    import java as j

As that would require deeper changes in the compiler.
@scala-jenkins scala-jenkins added this to the 2.13.6 milestone Apr 19, 2021
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Apr 19, 2021
@hmemcpy
Copy link

hmemcpy commented Jun 10, 2021

Sorry for bumping this issue, I just noticed that this doesn't work in 2.13.6:

import scala.util.{Try, *}

I'm getting the error: object * is not a member of package util

This compiles just fine in Scala 3.

Is this a limitation of -Xsource:3 or a possible bug?

@smarter
Copy link
Member Author

smarter commented Jun 10, 2021

@hmemcpy This is fixed in #9639

@hmemcpy
Copy link

hmemcpy commented Jun 10, 2021

Ah, cheers! Was this released?
I'm asking because IntelliJ's latest EAP is currently offering this refactoring for -Xsource:3 users during "optimize usings", and it leaves broken code. I was about to report it there, next.

@smarter
Copy link
Member Author

smarter commented Jun 10, 2021

This PR will be part of 2.13.7.

@hmemcpy
Copy link

hmemcpy commented Jun 10, 2021

Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
5 participants