Closed
Description
Compiler version
3.4.2
Minimized code
package p {
class IO
}
import java.io.*
package q {
import p.*
class D extends IO
}
Output
-- [E049] Reference Error: masked.scala:8:18 ---------------------------------------------------------------------------
8 | class D extends IO
| ^^
| Reference to IO is ambiguous.
| It is both imported by import java.io._
| and imported subsequently by import p._
|
| longer explanation available when compiling with `-explain`
1 error found
Expectation
p.IO
shadows java.io.IO
as in Scala 2.
This test requires JDK 23, but let me minimize properly, which also fails in the same way:
package r {
class IO
}
package p {
class IO
}
//import java.io.*
import r.*
package q {
import p.*
class D extends IO
object Test extends App {
println(new D().getClass.getSuperclass.getName)
}
}
Note that -Yimports:java.io,p
works correctly (without imports in source), as expected.
The issue is urgent where p
is cats.effect
.