Skip to content

Commit 0f0d25c

Browse files
authored
Merge pull request #7936 from dotty-staging/fix-#2887
Fix #2887: Add regression test
2 parents 924bcd9 + 75775a2 commit 0f0d25c

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

tests/neg/i2887a.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait A { type L[G[F[_],_],H[F[_],_]] }
2+
trait B { type L[F[_],_] }
3+
trait C { type M <: A }
4+
trait D { type M >: B }
5+
6+
object Test {
7+
def test(x: C with D): Unit = {
8+
def foo(a: A, b: B)(z: a.L[b.L,b.L]) = z
9+
def bar(y: x.M, b: B) = foo(y, b)
10+
def baz(b: B) = bar(b, b)
11+
baz(new B { type L[F[_],X] = F[X] })(1) // error
12+
}
13+
}

tests/neg/i2887b.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait A { type S[X[_] <: [_] => Any, Y[_]] <: [_] => Any; type I[_] } // error // error
2+
trait B { type S[X[_],Y[_]]; type I[_] <: [_] => Any } // error
3+
trait C { type M <: B }
4+
trait D { type M >: A }
5+
6+
object Test {
7+
def test(x: C with D): Unit = {
8+
def foo(a: A, b: B)(z: a.S[b.I,a.I][b.S[a.I,a.I]]) = z // error
9+
def bar(a: A, y: x.M) = foo(a,y)
10+
def baz(a: A) = bar(a, a)
11+
baz(new A { type S[X[_] <: [_] => Any, Y[_]] = [Z] => X[Z][Y[Z]]; type I[X] = X })(1) // error // error
12+
}
13+
}

tests/neg/i2887c.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait A { type S[X[_,_], Y[_],_]; type I[_] }
2+
trait B { type S[X[_],Y[_]]; type I[_,_] }
3+
trait C { type M <: B }
4+
trait D { type M >: A }
5+
6+
object Test {
7+
def test(x: C with D): Unit = {
8+
def foo(a: A, b: B)(z: a.S[b.I,a.I,b.S[a.I,a.I]]) = z
9+
def bar(a: A, y: x.M) = foo(a,y)
10+
def baz(a: A) = bar(a, a)
11+
baz(new A { type S[X[_,_], Y[_], Z] = X[Z,Y[Z]]; type I[X] = X })(1) // error
12+
}
13+
}

0 commit comments

Comments
 (0)