-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:picklingarea:typerbacklogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug
Description
The following code compiles successfully on Scala 2.12.10, but fails to do so on Dotty
object DepTest {
trait Trait {
case class Dependent()
}
object obj extends Trait
case class Dep[T <: Trait](t: T) {
def fun(q: t.Dependent): Unit = ???
}
Dep(obj).fun(obj.Dependent())
}
In order to make it compile, the type parameter of Dep
must be explicitly specified, i.e. Dep[obj.type](obj)
A cross compiling working example is available at
https://github.com/andres-pipicello/dotty-issues/tree/master
These are the sbt
steps to reproduce the issue, with their output
~/git/dotty-issues ⑂master* $ sbt
...
sbt:dotty-cross> ++ 2.12.10
...
sbt:dotty-cross> compile
...
[success] Total time: 3 s, completed Oct 12, 2019, 7:09:08 PM
sbt:dotty-cross> ++ 0.19.0-RC1
...
sbt:dotty-cross> compile
[info] Updating ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/apipicello/git/dotty-issues/target/scala-0.19/classes ...
[error] -- [E007] Type Mismatch Error: /Users/apipicello/git/dotty-issues/src/main/scala/DepTest.scala:9:28
[error] 9 | Dep(obj).fun(obj.Dependent())
[error] | ^^^^^^^^^^^^^^^
[error] | Found: DepTest.obj.Dependent
[error] | Required: Nothing
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 2 s, completed Oct 12, 2019, 7:09:28 PM
sbt:dotty-cross>
Metadata
Metadata
Assignees
Labels
area:picklingarea:typerbacklogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug