Skip to content

Commit

Permalink
Comment on the empty cases in notNullInfoFromCases.
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Dec 10, 2024
1 parent 00430c0 commit 200c038
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2147,9 +2147,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
}

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

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

0 comments on commit 200c038

Please sign in to comment.