Skip to content

Commit 0274907

Browse files
committed
Fix #8083: Add test case
1 parent 51b1f2c commit 0274907

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/pos/i8083.scala

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
trait A {
2+
class B
3+
}
4+
abstract class Test2 { val a: A; val b: a.B }
5+
object Test2 {
6+
def unapply(that: Test2): Option[(that.a.type, that.a.B)] = Some((that.a, that.b))
7+
}
8+
object anA extends A
9+
object Test extends App {
10+
val t: Test2 { val a: anA.type; val b: anA.B } = new Test2 { val a: anA.type = anA; val b = new a.B }
11+
t match {
12+
case Test2(u, v) =>
13+
u: A
14+
u: t.a.type // error
15+
v: t.a.B // error
16+
}
17+
}
18+
object Test1 extends App {
19+
object t extends Test2 { val a = anA; val b = new a.B }
20+
t match {
21+
case Test2(u, v) =>
22+
u: A
23+
u: t.a.type // error
24+
v: t.a.B // error
25+
}
26+
}

0 commit comments

Comments
 (0)