Skip to content

Commit 76ba6b2

Browse files
committed
Fix #4315: handle local child from scalac
1 parent ac84047 commit 76ba6b2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
497497
def refine(parent: Type, child: Symbol): Type = {
498498
if (child.isTerm && child.is(Case, butNot = Module)) return child.termRef // enum vals always match
499499

500+
if (child.name == tpnme.LOCAL_CHILD) return child.typeRef
501+
500502
val childTp = if (child.isTerm) child.termRef else child.typeRef
501503

502504
val resTp = instantiate(childTp, parent)(ctx.fresh.setNewTyperState())

tests/patmat/i4315.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import scala.concurrent.duration.{Duration, FiniteDuration}
2+
3+
class Test {
4+
def test(d: Duration) = d match {
5+
case finite: FiniteDuration =>
6+
case d =>
7+
}
8+
}

0 commit comments

Comments
 (0)