We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code compiles under scalac but not in dotty.
scalac
class Test { class Foo[+T](val x: T) def unfoo[T](foo: Foo[T]): T = foo.x def fooArray: Foo[Array[Object]] = new Foo(Array.empty[Object]) unfoo(fooArray) ++ unfoo(fooArray) }
It infers an imprecise type for one of the type argument of the second unfoo
unfoo
-- [E007] Type Mismatch Error: foo.scala:9:27 -------- 9 | unfoo(fooArray) ++ unfoo(fooArray) | ^^^^^^^^ | Found: Test.this.Foo[Array[Object]] | Required: Test.this.Foo[scala.collection.GenTraversableOnce[Any]]
result of foo.scala after frontend: package <empty> { class Test() extends Object() { class Foo[T >: Nothing <: Any](x: T) extends Object() { +T val x: T } def unfoo[T >: Nothing <: Any](foo: Test.this.Foo[T]): T = foo.x def fooArray: Test.this.Foo[Array[Object]] = new Test.this.Foo[Array[Object]]( Array.empty[Object]( scala.reflect.ClassTag.apply[Object](classOf[Object]) ) ) refArrayOps[Object](this.unfoo[Array[Object]](this.fooArray)).++[Object, Array[Object] ](this.unfoo[scala.collection.GenTraversableOnce[Object]](this.fooArray))( Array.canBuildFrom[Object]( scala.reflect.ClassTag.apply[Object](classOf[Object]) ) ) } }
The text was updated successfully, but these errors were encountered:
e41bf5d
Merge pull request #7939 from dotty-staging/fix-#6126
f192a47
Fix #6126: Add regression test
No branches or pull requests
The following code compiles under
scalac
but not in dotty.It infers an imprecise type for one of the type argument of the second
unfoo
The text was updated successfully, but these errors were encountered: