From 076c96cce85068fcb6324af4328c0d4cd5ef8f6c Mon Sep 17 00:00:00 2001 From: odersky Date: Wed, 15 Jun 2022 22:53:04 +0200 Subject: [PATCH] Convert remaining underlying -> superType --- .../tools/dotc/transform/ExplicitOuter.scala | 4 ++-- .../dotty/tools/dotc/transform/TypeUtils.scala | 2 +- .../src/dotty/tools/dotc/typer/Deriving.scala | 4 ++-- .../dotty/tools/dotc/typer/ErrorReporting.scala | 4 ++-- .../src/dotty/tools/dotc/typer/Implicits.scala | 16 ++++++++-------- .../src/dotty/tools/dotc/typer/Synthesizer.scala | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 978ec2ce777f..349f02e53c7c 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -316,10 +316,10 @@ object ExplicitOuter { else tpe.prefix case _ => // Need to be careful to dealias before erasure, otherwise we lose prefixes. - atPhaseNoLater(erasurePhase)(outerPrefix(tpe.underlying)) + atPhaseNoLater(erasurePhase)(outerPrefix(tpe.superType)) } case tpe: TypeProxy => - outerPrefix(tpe.underlying) + outerPrefix(tpe.superType) } /** It's possible (i1755.scala gives an example) that the type diff --git a/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala b/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala index becf0b4ea789..00c09a3ebf07 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala @@ -104,7 +104,7 @@ object TypeUtils { case self @ TypeRef(prefix, _) if self.symbol.isClass => prefix.select(self.symbol.companionModule).asInstanceOf[TermRef] case self: TypeProxy => - self.underlying.mirrorCompanionRef + self.superType.mirrorCompanionRef } /** Is this type a methodic type that takes implicit parameters (both old and new) at some point? */ diff --git a/compiler/src/dotty/tools/dotc/typer/Deriving.scala b/compiler/src/dotty/tools/dotc/typer/Deriving.scala index 22c73b92802a..0f3a138d0390 100644 --- a/compiler/src/dotty/tools/dotc/typer/Deriving.scala +++ b/compiler/src/dotty/tools/dotc/typer/Deriving.scala @@ -33,7 +33,7 @@ trait Deriving { case tp: TypeRef if tp.symbol.isClass => tp case tp: TypeRef if tp.symbol.isAbstractType => NoType case tp: TermRef => NoType - case tp: TypeProxy => underlyingClassRef(tp.underlying) + case tp: TypeProxy => underlyingClassRef(tp.superType) case _ => NoType } @@ -286,7 +286,7 @@ trait Deriving { case tp @ TypeRef(prefix, _) if tp.symbol.isClass => prefix.select(tp.symbol.companionModule).asInstanceOf[TermRef] case tp: TypeProxy => - companionRef(tp.underlying) + companionRef(tp.superType) } val resultType = instantiated(sym.info) val companion = companionRef(resultType) diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala index a1010f48c5b7..780f29417bab 100644 --- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -257,7 +257,7 @@ class ImplicitSearchError( ++ ErrorReporting.matchReductionAddendum(pt) } - private def formatMsg(shortForm: String)(headline: String = shortForm) = arg match + private def formatMsg(shortForm: String)(headline: String = shortForm) = arg match case arg: Trees.SearchFailureIdent[?] => arg.tpe match case _: NoMatchingImplicits => headline @@ -387,7 +387,7 @@ class ImplicitSearchError( .map(userDefinedImplicitNotFoundTypeMessage) .find(_.isDefined).flatten case tp: TypeProxy => - recur(tp.underlying) + recur(tp.superType) case tp: AndType => recur(tp.tp1).orElse(recur(tp.tp2)) case _ => diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 2544fe1bb04e..3b188d6507b4 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -549,16 +549,16 @@ object Implicits: override def msg(using Context) = _msg def explanation(using Context) = msg.toString - /** A search failure type for failed synthesis of terms for special types */ + /** A search failure type for failed synthesis of terms for special types */ class SynthesisFailure(reasons: List[String], val expectedType: Type) extends SearchFailureType: def argument = EmptyTree - private def formatReasons = - if reasons.length > 1 then - reasons.mkString("\n\t* ", "\n\t* ", "") - else + private def formatReasons = + if reasons.length > 1 then + reasons.mkString("\n\t* ", "\n\t* ", "") + else reasons.mkString - + def explanation(using Context) = em"Failed to synthesize an instance of type ${clarify(expectedType)}: ${formatReasons}" end Implicits @@ -763,7 +763,7 @@ trait ImplicitRunInfo: WildcardType else seen += t - t.underlying match + t.superType match case TypeBounds(lo, hi) => if lo.isBottomTypeAfterErasure then apply(hi) else AndType.make(apply(lo), apply(hi)) @@ -871,7 +871,7 @@ trait Implicits: SearchFailure(new SynthesisFailure(errors, formal), span).tree else tree.orElse(failed) - + /** Search an implicit argument and report error if not found */ def implicitArgTree(formal: Type, span: Span)(using Context): Tree = { diff --git a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala index 171e171f33f1..e152a0e3443a 100644 --- a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala @@ -365,7 +365,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context): // avoid type aliases for tuples Right(MirrorSource.GenericTuple(types)) case _ => reduce(tp.underlying) - case _ => reduce(tp.underlying) + case _ => reduce(tp.superType) case tp @ AndType(l, r) => for lsrc <- reduce(l)