Skip to content

Commit d3d4198

Browse files
committed
Assert that Match are not created without any CaseDef
1 parent ec19d75 commit d3d4198

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

+1
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ object Trees {
520520
/** selector match { cases } */
521521
case class Match[-T >: Untyped] private[ast] (selector: Tree[T], cases: List[CaseDef[T]])
522522
extends TermTree[T] {
523+
assert(cases.nonEmpty)
523524
type ThisTree[-T >: Untyped] = Match[T]
524525
def isInline = false
525526
}

tests/run/literals.decompiled

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/runTestFromTasty/run/literals/Test.tasty */
1+
/** Decompiled from out/runTestFromTasty/run/literals/Test.class */
22
object Test {
33
def αρετη: java.lang.String = "alpha rho epsilon tau eta"
44
case class GGG(i: scala.Int) {
@@ -95,4 +95,4 @@ object Test {
9595
val ggg: scala.Int = Test.GGG.apply(1).αα(Test.GGG.apply(2))
9696
Test.check_success[scala.Int]("ggg == 3", ggg, 3)
9797
}
98-
}
98+
}

0 commit comments

Comments
 (0)