Skip to content

Commit 200c038

Browse files
committed
Comment on the empty cases in notNullInfoFromCases.
1 parent 00430c0 commit 200c038

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: compiler/src/dotty/tools/dotc/typer/Typer.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -2147,9 +2147,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
21472147
}
21482148

21492149
private def notNullInfoFromCases(initInfo: NotNullInfo, cases: List[CaseDef])(using Context): NotNullInfo =
2150-
if cases.nonEmpty then
2151-
initInfo.seq(cases.map(_.notNullInfo).reduce(_.alt(_)))
2152-
else initInfo
2150+
if cases.isEmpty then
2151+
// Empty cases is not allowed for match tree in the source code,
2152+
// but it can be generated by inlining: `tests/pos/i19198.scala`.
2153+
initInfo
2154+
else cases.map(_.notNullInfo).reduce(_.alt(_))
21532155

21542156
def typedCases(cases: List[untpd.CaseDef], sel: Tree, wideSelType0: Type, pt: Type)(using Context): List[CaseDef] =
21552157
var caseCtx = ctx

0 commit comments

Comments
 (0)