Skip to content

Commit bebf94a

Browse files
oderskynicolasstucki
authored andcommitted
A more precise AssertNotNull test
This is not needed to fix #9321, but useful anyway.
1 parent f5dde7f commit bebf94a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
907907
def unapply(tree: tpd.TypeApply)(using Context): Option[tpd.Tree] = tree match
908908
case TypeApply(Select(qual: RefTree, nme.asInstanceOfPM), arg :: Nil) =>
909909
arg.tpe match
910-
case AndType(ref, _) if qual.tpe eq ref => Some(qual)
910+
case AndType(ref, nn1) if qual.tpe eq ref =>
911+
qual.tpe.widen match
912+
case OrNull(nn2) if nn1 eq nn2 =>
913+
Some(qual)
914+
case _ => None
911915
case _ => None
912916
case _ => None
913917
end AssertNotNull

0 commit comments

Comments
 (0)