Closed
Description
I have three files:
package foo
object A {
val x = 5
}
package foo.bar
object A {
val x = "foo"
}
package foo
import foo.bar._
object B {
val y: Int = A.x
}
They compile with Scala 2.12. With Dotty, I get:
-- [E007] Type Mismatch Error: /tmp/foo/B.scala:5:17 ---------------------------
5 | val y: Int = A.x
| ^^^
| found: String(foo.bar.A.x)
| required: Int
|
one error found
In object foo.B, Scala 2.12 prefers foo.A over foo.bar.A because foo.A is in the same package. But Dotty seems to prefer foo.bar.A over foo.A because foo.bar.A is being imported.
Metadata
Metadata
Assignees
Labels
No labels