Skip to content

Commit 78cd47a

Browse files
committed
Add regression test for scala#6505
Fixes scala#6505
1 parent 8c404b1 commit 78cd47a

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

compiler/test/dotc/pos-test-pickling.blacklist

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ i9999.scala
4040
9890.scala
4141
13491.scala
4242
7512.scala
43+
i6505.scala
4344

4445
# Opaque type
4546
i5720.scala

tests/pos/i6505.scala

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
class Foo {
2+
3+
type E[X]
4+
5+
def i: Int = ???
6+
def e: E[Int] = ???
7+
8+
// Transforms `(T1, ... Tn)` into `(E[T1], ..., E[Tn])`
9+
type F[T <: Tuple] <: Tuple = T match {
10+
case EmptyTuple => EmptyTuple
11+
case h *: t => E[h] *: F[t]
12+
}
13+
14+
def foo1[Args <: Tuple](args: Args, args2: F[Args]): Unit = ()
15+
16+
foo1((i, i), (e, e)) // fails
17+
foo1((i, i), (e, e): F[(Int, Int)]) // fails
18+
19+
}
20+
21+
class Foo2 {
22+
23+
type E[X]
24+
25+
def i: Int = ???
26+
def e: E[Int] = ???
27+
28+
// Transforms `(T1, ... Tn)` into `(E[T1], ..., E[Tn])`
29+
type F[T <: Tuple] <: Tuple = T match {
30+
case EmptyTuple => EmptyTuple
31+
case h *: t => E[h] *: F[t]
32+
}
33+
34+
def foo2[Args <: Tuple, Args2 >: F[Args] <: F[Args]](args: Args, args2: Args2): Unit = ()
35+
36+
foo2((i, i), (e, e)) // fails
37+
38+
// all these work
39+
foo2[(Int, Int), F[(Int, Int)]]((i, i), (e, e))
40+
foo2[(Int, Int), F[(Int, Int)]]((i, i), (e, e))
41+
foo2[(Int, Int), F[Int *: Int *: EmptyTuple]]((i, i), (e, e))
42+
foo2[(Int, Int), (E[Int], E[Int])]((i, i), (e, e))
43+
foo2[(Int, Int), E[Int] *: E[Int] *: EmptyTuple]((i, i), (e, e))
44+
45+
}

0 commit comments

Comments
 (0)