@@ -359,7 +359,7 @@ object Types {
359359 * (since these are relevant for inference or resolution) but never consider prefixes
360360 * (since these often do not constrain the search space anyway).
361361 */
362- def unusableForInference (using Context ): Boolean = widenDealias match
362+ def unusableForInference (using Context ): Boolean = try widenDealias match
363363 case AppliedType (tycon, args) => tycon.unusableForInference || args.exists(_.unusableForInference)
364364 case RefinedType (parent, _, rinfo) => parent.unusableForInference || rinfo.unusableForInference
365365 case TypeBounds (lo, hi) => lo.unusableForInference || hi.unusableForInference
@@ -369,6 +369,7 @@ object Types {
369369 case CapturingType (parent, refs) => parent.unusableForInference || refs.elems.exists(_.unusableForInference)
370370 case _ : ErrorType => true
371371 case _ => false
372+ catch case ex : Throwable => handleRecursive(" unusableForInference" , show, ex)
372373
373374 /** Does the type carry an annotation that is an instance of `cls`? */
374375 @ tailrec final def hasAnnotation (cls : ClassSymbol )(using Context ): Boolean = stripTypeVar match {
@@ -3490,9 +3491,11 @@ object Types {
34903491 private var myWidened : Type = _
34913492
34923493 private def computeAtoms ()(using Context ): Atoms =
3493- if tp1.hasClassSymbol(defn.NothingClass ) then tp2.atoms
3494- else if tp2.hasClassSymbol(defn.NothingClass ) then tp1.atoms
3495- else tp1.atoms | tp2.atoms
3494+ val tp1n = tp1.normalized
3495+ val tp2n = tp2.normalized
3496+ if tp1n.hasClassSymbol(defn.NothingClass ) then tp2.atoms
3497+ else if tp2n.hasClassSymbol(defn.NothingClass ) then tp1.atoms
3498+ else tp1n.atoms | tp2n.atoms
34963499
34973500 private def computeWidenSingletons ()(using Context ): Type =
34983501 val tp1w = tp1.widenSingletons
0 commit comments