@@ -1555,11 +1555,13 @@ object Types extends TypeUtils {
15551555 if (normed.exists) normed else this
15561556 }
15571557
1558- /** If this type can be normalized at the top-level by rewriting match types
1559- * of S[n] types, the result after applying all toplevel normalizations,
1560- * otherwise NoType
1558+ /** If this type has an underlying match type or applied compiletime.ops,
1559+ * then the result after applying all toplevel normalizations, otherwise NoType.
15611560 */
1562- def tryNormalize (using Context ): Type = NoType
1561+ def tryNormalize (using Context ): Type = underlyingNormalizable match
1562+ case mt : MatchType => mt.tryNormalize
1563+ case tp : AppliedType => tp.tryCompiletimeConstantFold
1564+ case _ => NoType
15631565
15641566 private def widenDealias1 (keep : AnnotatedType => Context ?=> Boolean )(using Context ): Type = {
15651567 val res = this .widen.dealias1(keep, keepOpaques = false )
@@ -4692,14 +4694,9 @@ object Types extends TypeUtils {
46924694 cachedUnderlyingNormalizable
46934695
46944696 override def tryNormalize (using Context ): Type =
4695- def tryMatchAlias =
4696- if isMatchAlias then trace(i " normalize $this" , typr, show = true ):
4697- if MatchTypeTrace .isRecording then
4698- MatchTypeTrace .recurseWith(this )(superType.tryNormalize)
4699- else
4700- underlyingNormalizable.tryNormalize
4701- else NoType
4702- tryCompiletimeConstantFold.orElse(tryMatchAlias)
4697+ if isMatchAlias && MatchTypeTrace .isRecording then
4698+ MatchTypeTrace .recurseWith(this )(superType.tryNormalize)
4699+ else super .tryNormalize
47034700
47044701 /** Is this an unreducible application to wildcard arguments?
47054702 * This is the case if tycon is higher-kinded. This means
0 commit comments