Skip to content

Commit ed40359

Browse files
committed
fix typeMemberTouched and add a testcase
1 parent 25aa162 commit ed40359

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/core/PatternTypeConstrainer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ trait PatternTypeConstrainer { self: TypeComparer =>
144144
ctx.gadt.bounds(scrut.symbol) match {
145145
case tb: TypeBounds =>
146146
val hi = tb.hi
147-
constrainPatternType(pat, hi)
147+
constrainPatternType(pat, hi, typeMembersTouched = true)
148148
case null => true
149149
}
150150
case _ => true

tests/pos/pdgadt-path.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait Expr
2+
case class IntLit(b: Int) extends Expr
3+
4+
def foo[M <: Expr](e: M) = e match {
5+
case e1: IntLit =>
6+
val t0: e1.type = e
7+
val t1: e.type = e1
8+
}

0 commit comments

Comments
 (0)