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

Allow import x.{*, given} under -Xsource:3 #9724

Merged
merged 1 commit into from Aug 25, 2021
Merged

Commits on Aug 24, 2021

  1. Allow import x.{*, given} under -Xsource:3

    Imagine a Scala 3 library containing:
    ```
    object A {
      val a: Int = 1
      given b: Int = 2
    }
    ```
    To import all members of `A` from Scala 2, we write `import A.*`,
    but to do the same from Scala 3, we need to write `import A.{*, given}`
    instead. This complicates cross-compilation for projects which depend on
    Scala 3 libraries (unless these libraries exclusively use `implicit`
    which is not something we want to encourage).
    
    This commit remedies this by allowing `import x.{*, given}` (and `import
    x.{given, *}`), this is easy to do since we can just pretend the user
    wrote `import x.*` which will give us both regular and given members in
    Scala 2 code and therefore match the semantics of Scala 3.
    smarter committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    3af1547 View commit details
    Browse the repository at this point in the history