Skip to content

Commit 00f09ac

Browse files
noti0na1tgodzik
authored andcommitted
Comment on the empty cases in notNullInfoFromCases.
[Cherry-picked 200c038]
1 parent 5710a74 commit 00f09ac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

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

18701870
private def notNullInfoFromCases(initInfo: NotNullInfo, cases: List[CaseDef])(using Context): NotNullInfo =
1871-
if cases.nonEmpty then
1872-
initInfo.seq(cases.map(_.notNullInfo).reduce(_.alt(_)))
1873-
else initInfo
1871+
if cases.isEmpty then
1872+
// Empty cases is not allowed for match tree in the source code,
1873+
// but it can be generated by inlining: `tests/pos/i19198.scala`.
1874+
initInfo
1875+
else cases.map(_.notNullInfo).reduce(_.alt(_))
18741876

18751877
def typedCases(cases: List[untpd.CaseDef], sel: Tree, wideSelType: Type, pt: Type)(using Context): List[CaseDef] =
18761878
var caseCtx = ctx

0 commit comments

Comments
 (0)