Skip to content

Commit 4e27694

Browse files
committed
Revert "Reduce projections of type aliases with class type prefixes"
1 parent 1a6e3ae commit 4e27694

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/Types.scala

+4-12
Original file line numberDiff line numberDiff line change
@@ -2598,22 +2598,14 @@ object Types extends TypeUtils {
25982598
case _ => true
25992599
}
26002600

2601-
/** Reduce a type ref P # X, where X is a type alias and P is a refined type or
2602-
* a class type. If P is a refined type `T { X = U; ... }`, reduce P to U,
2603-
* provided U does not refer with a RecThis to the same refined type. If P is a
2604-
* class type, reduce it to the dealiasd version of P # X. This means that at typer
2605-
* we create projections only for inner classes with class prefixes, since projections
2606-
* of P # X where X is an abstract type are handled by skolemization. At later phases
2607-
* these projections might arise, though.
2601+
/** Reduce a type-ref `T { X = U; ... } # X` to `U`
2602+
* provided `U` does not refer with a RecThis to the
2603+
* refinement type `T { X = U; ... }`
26082604
*/
26092605
def reduceProjection(using Context): Type =
26102606
if (isType) {
26112607
val reduced = prefix.lookupRefined(name)
2612-
if reduced.exists then reduced
2613-
else prefix.stripTypeVar match
2614-
case pre: (AppliedType | TypeRef)
2615-
if prefix.dealias.typeSymbol.isClass && this.symbol.isAliasType => dealias
2616-
case _ => this
2608+
if reduced.exists then reduced else this
26172609
}
26182610
else this
26192611

Diff for: tests/pos/i19892.scala

-26
This file was deleted.

0 commit comments

Comments
 (0)