Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9582 from smarter/wildcard-import
Support Scala 3 wildcard and renaming imports under -Xsource:3
- Loading branch information
Showing
5 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import-future.scala:15: error: not found: value unrelated | ||
unrelated(1) // error | ||
^ | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// scalac: -Xsource:3 | ||
// | ||
|
||
class D { | ||
def *(y: Int): Int = y | ||
def unrelated(y: Int): Int = y | ||
} | ||
|
||
object Test { | ||
val d = new D | ||
|
||
def one: Int = { | ||
import d.`*` | ||
|
||
unrelated(1) // error | ||
|
||
*(1) | ||
} | ||
|
||
def two: Int = { | ||
import d.* | ||
|
||
unrelated(1) | ||
|
||
*(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// scalac: -Xsource:3 | ||
// | ||
|
||
import java.io as jio | ||
import scala.{collection as c} | ||
|
||
import c.mutable as mut | ||
import mut.ArrayBuffer as Buf | ||
|
||
object O { | ||
val x: jio.IOException = ??? | ||
val y = Buf(1, 2, 3) | ||
|
||
type OString = String | ||
def foo22(x: Int) = x | ||
} | ||
|
||
class C { | ||
import O.{ foo22 as foo, OString as OS } | ||
println(foo(22)) | ||
val s: OS = "" | ||
|
||
import mut.* | ||
val ab = ArrayBuffer(1) | ||
} |