Skip to content

Commit 13781b1

Browse files
Use underlyingMatchType for tryNormalize
1 parent 93cff1e commit 13781b1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,16 +1527,15 @@ object Types extends TypeUtils {
15271527
/** The result of normalization using `tryNormalize`, or the type itself if
15281528
* tryNormlize yields NoType
15291529
*/
1530-
final def normalized(using Context): Type = {
1531-
val normed = tryNormalize
1532-
if (normed.exists) normed else this
1533-
}
1530+
final def normalized(using Context): Type = tryNormalize.orElse(this)
15341531

15351532
/** If this type can be normalized at the top-level by rewriting match types
15361533
* of S[n] types, the result after applying all toplevel normalizations,
15371534
* otherwise NoType
15381535
*/
1539-
def tryNormalize(using Context): Type = NoType
1536+
def tryNormalize(using Context): Type =
1537+
if isMatchAlias then underlyingMatchType.tryNormalize
1538+
else NoType
15401539

15411540
private def widenDealias1(keep: AnnotatedType => Context ?=> Boolean)(using Context): Type = {
15421541
val res = this.widen.dealias1(keep, keepOpaques = false)

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ tuple-fold.scala
6666
mt-redux-norm.perspective.scala
6767
i18211.scala
6868
10867.scala
69+
matchtype.scala
6970

7071
# Opaque type
7172
i5720.scala

compiler/test/dotc/run-test-pickling.blacklist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ i12656.scala
4646
trait-static-forwarder
4747
i17255
4848

49+
# Match types
50+
i13332a.scala
51+
anon-mirror-gen-local.scala

0 commit comments

Comments
 (0)