Skip to content

Commit fa3c400

Browse files
committed
Add remaining SI-2712 testcases from Scala 2
It turns out that neg/t2712-2.scala actually works in Dotty due to better type inference.
1 parent 2431449 commit fa3c400

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/neg/t2712-8.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
object Test extends App {
2+
class L[A]
3+
class Quux0[B, CC[_]]
4+
class Quux[C] extends Quux0[C, L]
5+
6+
def foo[D[_]](x: D[D[Boolean]]) = ???
7+
def bar: Quux[Int] = ???
8+
9+
foo(bar) // error: Found: Test.Quux[Int] Required: D[D[Boolean]]
10+
}

tests/pos/t2712-2b.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package test
2+
3+
class X1
4+
class X2
5+
class X3
6+
7+
trait One[A]
8+
trait Two[A, B]
9+
10+
class Foo extends Two[X1, X2] with One[X3]
11+
object Test {
12+
def test1[M[_], A](x: M[A]): M[A] = x
13+
14+
val foo = new Foo
15+
16+
test1(foo): One[X3] // fails in Scala 2 with partial unification enabled, works in Dotty
17+
test1(foo): Two[X1, X2]
18+
}

0 commit comments

Comments
 (0)