Skip to content

Commit 6fa4767

Browse files
committed
Map underlying -> superType in transformations
1 parent 567d95f commit 6fa4767

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ object ExplicitOuter {
317317
case _ =>
318318
// Need to be careful to dealias before erasure, otherwise we lose prefixes.
319319
atPhaseNoLater(erasurePhase)(outerPrefix(tpe.underlying))
320+
// underlying is fine here and below since we are calling this after erasure.
321+
// However, there is some weird stuff going on with parboiled2 where an
322+
// AppliedType with a type alias as constructor is fed to outerPrefix.
323+
// For some other unknown reason this works with underlying but not with superType.
324+
// I was not able to minimize the problem and parboiled2 spits out way too much
325+
// macro generated code to be able to pinpoint the root problem.
320326
}
321327
case tpe: TypeProxy =>
322328
outerPrefix(tpe.underlying)

compiler/src/dotty/tools/dotc/transform/TypeUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object TypeUtils {
104104
case self @ TypeRef(prefix, _) if self.symbol.isClass =>
105105
prefix.select(self.symbol.companionModule).asInstanceOf[TermRef]
106106
case self: TypeProxy =>
107-
self.underlying.mirrorCompanionRef
107+
self.superType.mirrorCompanionRef
108108
}
109109

110110
/** Is this type a methodic type that takes implicit parameters (both old and new) at some point? */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ trait Deriving {
286286
case tp @ TypeRef(prefix, _) if tp.symbol.isClass =>
287287
prefix.select(tp.symbol.companionModule).asInstanceOf[TermRef]
288288
case tp: TypeProxy =>
289-
companionRef(tp.underlying)
289+
companionRef(tp.superType)
290290
}
291291
val resultType = instantiated(sym.info)
292292
val companion = companionRef(resultType)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class ImplicitSearchError(
387387
.map(userDefinedImplicitNotFoundTypeMessage)
388388
.find(_.isDefined).flatten
389389
case tp: TypeProxy =>
390-
recur(tp.underlying)
390+
recur(tp.superType)
391391
case tp: AndType =>
392392
recur(tp.tp1).orElse(recur(tp.tp2))
393393
case _ =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ trait ImplicitRunInfo:
763763
WildcardType
764764
else
765765
seen += t
766-
t.underlying match
766+
t.superType match
767767
case TypeBounds(lo, hi) =>
768768
if lo.isBottomTypeAfterErasure then apply(hi)
769769
else AndType.make(apply(lo), apply(hi))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
366366
// avoid type aliases for tuples
367367
Right(MirrorSource.GenericTuple(types))
368368
case _ => reduce(tp.underlying)
369-
case _ => reduce(tp.underlying)
369+
case _ => reduce(tp.superType)
370370
case tp @ AndType(l, r) =>
371371
for
372372
lsrc <- reduce(l)

0 commit comments

Comments
 (0)