Skip to content

Commit 54aac8a

Browse files
committed
Revert "Heal member-select on opaque reference"
This reverts commit 4443395.
1 parent 4eb7668 commit 54aac8a

File tree

4 files changed

+1
-50
lines changed

4 files changed

+1
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
14941494
* Note: It would be legal to do the lifting also if M does not contain opaque types,
14951495
* but in this case the retries in tryLiftedToThis would be redundant.
14961496
*/
1497-
def liftToThis(tp: Type): Type = {
1497+
private def liftToThis(tp: Type): Type = {
14981498

14991499
def findEnclosingThis(moduleClass: Symbol, from: Symbol): Type =
15001500
if ((from.owner eq moduleClass) && from.isPackageObject && from.is(Opaque)) from.thisType

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -715,18 +715,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
715715
typedSelectWithAdapt(tree, pt, qual)
716716
else EmptyTree
717717

718-
// Otherwise, heal member selection on an opaque reference,
719-
// reusing the logic in TypeComparer.
720-
def tryLiftToThis() =
721-
val wtp = qual.tpe.widen
722-
val liftedTp = comparing(_.liftToThis(wtp))
723-
if liftedTp ne wtp then
724-
val qual1 = qual.cast(liftedTp)
725-
val tree1 = cpy.Select(tree0)(qual1, selName)
726-
val rawType1 = selectionType(tree1, qual1)
727-
tryType(tree1, qual1, rawType1)
728-
else EmptyTree
729-
730718
// Otherwise, map combinations of A *: B *: .... EmptyTuple with nesting levels <= 22
731719
// to the Tuple class of the right arity and select from that one
732720
def trySmallGenericTuple(qual: Tree, withCast: Boolean) =
@@ -793,7 +781,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
793781
tryType(tree, qual, rawType)
794782
.orElse(trySimplifyApply())
795783
.orElse(tryInstantiateTypeVar())
796-
.orElse(tryLiftToThis())
797784
.orElse(trySmallGenericTuple(qual, withCast = true))
798785
.orElse(tryExt(tree, qual))
799786
.orElse(tryGadt())

tests/pos/i19609.orig.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/pos/i19609.scala

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)