Skip to content

Commit d087c43

Browse files
committed
Move stripLazyRef inside simplified
1 parent 8c08568 commit d087c43

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3261,7 +3261,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
32613261
// then TypeComparer will eventually start returning `false` for `isSubType`.
32623262
// Or, under -Yno-deep-subtypes, start throwing AssertionErrors.
32633263
// So, we eagerly strip that lazy ref here to avoid the stacking.
3264-
tp.stripLazyRef.simplified
3264+
tp.simplified
32653265
case Nil =>
32663266
val casesText = MatchTypeTrace.noMatchesText(scrut, cases)
32673267
ErrorType(reporting.MatchTypeNoCases(casesText))

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,11 @@ object Types {
19841984
* this method handles this by never simplifying inside a `MethodicType`,
19851985
* except for replacing type parameters with associated type variables.
19861986
*/
1987-
def simplified(using Context): Type = TypeOps.simplify(this, null)
1987+
def simplified(using Context): Type =
1988+
// stripping LazyRef is important for the reduction of applied match types
1989+
// see the comment in matchCases/recur for more details
1990+
val tp = stripLazyRef
1991+
TypeOps.simplify(tp, null)
19881992

19891993
/** Compare `this == that`, assuming corresponding binders in `bs` are equal.
19901994
* The normal `equals` should be equivalent to `equals(that, null`)`.

0 commit comments

Comments
 (0)