Skip to content

Commit 0fe56ea

Browse files
authored
Merge pull request #2257 from dotty-staging/fix-2253
Fix #2253: avoid match exception in case of refinement types
2 parents de6461a + fb4adc3 commit 0fe56ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
537537
tp.refinedName,
538538
tpb.derivedTypeBounds(follow(lo, false), follow(hi, true))
539539
)
540+
case tp => tp
540541
}
541542
case _ => tp
542543
}

tests/patmat/i2253.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sealed trait S
2+
object O extends S
3+
trait T
4+
5+
class Test {
6+
def m(s: S { val x: Int }) = s match { case _: T => ; }
7+
}

0 commit comments

Comments
 (0)