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

[backport] Allow import x.{*, given} under -Xsource:3 #9736

Merged
merged 1 commit into from Aug 25, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Aug 24, 2021

This backports #9724 to Scala 2.12.

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.
@scala-jenkins scala-jenkins added this to the 2.12.15 milestone Aug 24, 2021
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Aug 24, 2021
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
4 participants