Skip to content

Commit

Permalink
Convert remaining underlying -> superType
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jun 15, 2022
1 parent 608086f commit 076c96c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/TypeUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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? */
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Deriving.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 _ =>
Expand Down
16 changes: 8 additions & 8 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Synthesizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 076c96c

Please sign in to comment.