Skip to content

Commit e8749af

Browse files
authored
Merge pull request #8127 from dotty-staging/fix-#8083
Fix #8083: Add test case
2 parents 8904c96 + 0274907 commit e8749af

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/pos/i8083.scala

Lines changed: 26 additions & 0 deletions
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)