Skip to content

Commit b5ad502

Browse files
committed
Drop original parameter of adapt.
The parameter is never queried in current code, just passed along.
1 parent 426f25a commit b5ad502

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ object Erasure {
635635
super.typedStats(stats1, exprOwner).filter(!_.isEmpty)
636636
}
637637

638-
override def adapt(tree: Tree, pt: Type, original: untpd.Tree)(implicit ctx: Context): Tree =
638+
override def adapt(tree: Tree, pt: Type)(implicit ctx: Context): Tree =
639639
ctx.traceIndented(i"adapting ${tree.showSummary}: ${tree.tpe} to $pt", show = true) {
640640
assert(ctx.phase == ctx.erasurePhase.next, ctx.phase)
641641
if (tree.isEmpty) tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ class TreeChecker extends Phase with SymTransformer {
436436
override def ensureNoLocalRefs(tree: Tree, pt: Type, localSyms: => List[Symbol])(implicit ctx: Context): Tree =
437437
tree
438438

439-
override def adapt(tree: Tree, pt: Type, original: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context) = {
439+
override def adapt(tree: Tree, pt: Type)(implicit ctx: Context) = {
440440
def isPrimaryConstructorReturn =
441441
ctx.owner.isPrimaryConstructor && pt.isRef(ctx.owner.owner) && tree.tpe.isRef(defn.UnitClass)
442442
if (ctx.mode.isExpr &&

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
546546
init()
547547

548548
def addArg(arg: Tree, formal: Type): Unit =
549-
typedArgBuf += adaptInterpolated(arg, formal.widenExpr, EmptyTree)
549+
typedArgBuf += adaptInterpolated(arg, formal.widenExpr)
550550

551551
def makeVarArg(n: Int, elemFormal: Type): Unit = {
552552
val args = typedArgBuf.takeRight(n).toList
@@ -1477,7 +1477,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
14771477
def harmonize(trees: List[Tree])(implicit ctx: Context): List[Tree] = {
14781478
def adapt(tree: Tree, pt: Type): Tree = tree match {
14791479
case cdef: CaseDef => tpd.cpy.CaseDef(cdef)(body = adapt(cdef.body, pt))
1480-
case _ => adaptInterpolated(tree, pt, tree)
1480+
case _ => adaptInterpolated(tree, pt)
14811481
}
14821482
if (ctx.isAfterTyper) trees else harmonizeWith(trees)(_.tpe, adapt)
14831483
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ object ProtoTypes {
238238
*/
239239
def typedArg(arg: untpd.Tree, formal: Type)(implicit ctx: Context): Tree = {
240240
val targ = cacheTypedArg(arg, typer.typedUnadapted(_, formal))
241-
typer.adapt(targ, formal, arg)
241+
typer.adapt(targ, formal)
242242
}
243243

244244
/** The type of the argument `arg`.

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
17071707

17081708
def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree", typr, show = true) /*<|<*/ {
17091709
assertPositioned(tree)
1710-
try adapt(typedUnadapted(tree, pt), pt, tree)
1710+
try adapt(typedUnadapted(tree, pt), pt)
17111711
catch {
17121712
case ex: CyclicReference => errorTree(tree, cyclicErrorMsg(ex))
17131713
case ex: TypeError => errorTree(tree, ex.getMessage)
@@ -1854,7 +1854,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18541854
case Select(qual, name) =>
18551855
val qualProto = SelectionProto(name, pt, NoViewsAllowed, privateOK = false)
18561856
tryEither { implicit ctx =>
1857-
val qual1 = adaptInterpolated(qual, qualProto, EmptyTree)
1857+
val qual1 = adaptInterpolated(qual, qualProto)
18581858
if ((qual eq qual1) || ctx.reporter.hasErrors) None
18591859
else Some(typed(cpy.Select(tree)(untpd.TypedSplice(qual1), name), pt))
18601860
} { (_, _) => None
@@ -1863,12 +1863,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18631863
}
18641864
}
18651865

1866-
def adapt(tree: Tree, pt: Type, original: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context): Tree = /*>|>*/ track("adapt") /*<|<*/ {
1866+
def adapt(tree: Tree, pt: Type)(implicit ctx: Context): Tree = /*>|>*/ track("adapt") /*<|<*/ {
18671867
/*>|>*/ ctx.traceIndented(i"adapting $tree of type ${tree.tpe} to $pt", typr, show = true) /*<|<*/ {
18681868
if (tree.isDef) interpolateUndetVars(tree, tree.symbol)
18691869
else if (!tree.tpe.widen.isInstanceOf[LambdaType]) interpolateUndetVars(tree, NoSymbol)
18701870
tree.overwriteType(tree.tpe.simplified)
1871-
adaptInterpolated(tree, pt, original)
1871+
adaptInterpolated(tree, pt)
18721872
}
18731873
}
18741874

@@ -1910,7 +1910,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19101910
* (14) When in mode EXPRmode, apply a view
19111911
* If all this fails, error
19121912
*/
1913-
def adaptInterpolated(tree: Tree, pt: Type, original: untpd.Tree)(implicit ctx: Context): Tree = {
1913+
def adaptInterpolated(tree: Tree, pt: Type)(implicit ctx: Context): Tree = {
19141914

19151915
assert(pt.exists)
19161916

@@ -1928,7 +1928,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19281928
TermRef.withSigAndDenot(ref.prefix, ref.name, alt.info.signature, alt))
19291929
resolveOverloaded(alts, pt) match {
19301930
case alt :: Nil =>
1931-
adapt(tree.withType(alt), pt, original)
1931+
adapt(tree.withType(alt), pt)
19321932
case Nil =>
19331933
def noMatches =
19341934
errorTree(tree,
@@ -1965,7 +1965,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19651965
def adaptToArgs(wtp: Type, pt: FunProto): Tree = wtp match {
19661966
case _: MethodOrPoly =>
19671967
if (pt.args.lengthCompare(1) > 0 && isUnary(wtp) && ctx.canAutoTuple)
1968-
adaptInterpolated(tree, pt.tupled, original)
1968+
adaptInterpolated(tree, pt.tupled)
19691969
else
19701970
tree
19711971
case _ => tryInsertApplyOrImplicit(tree, pt) {
@@ -2001,7 +2001,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
20012001

20022002
def adaptNoArgs(wtp: Type): Tree = wtp match {
20032003
case wtp: ExprType =>
2004-
adaptInterpolated(tree.withType(wtp.resultType), pt, original)
2004+
adaptInterpolated(tree.withType(wtp.resultType), pt)
20052005
case wtp: ImplicitMethodType if constrainResult(wtp, followAlias(pt)) =>
20062006
val tvarsToInstantiate = tvarsInParams(tree)
20072007
wtp.paramInfos.foreach(instantiateSelected(_, tvarsToInstantiate))
@@ -2117,7 +2117,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
21172117
!(isSyntheticApply(tree) && !isExpandableApply))
21182118
typed(etaExpand(tree, wtp, arity), pt)
21192119
else if (wtp.paramInfos.isEmpty && isAutoApplied(tree.symbol))
2120-
adaptInterpolated(tpd.Apply(tree, Nil), pt, EmptyTree)
2120+
adaptInterpolated(tpd.Apply(tree, Nil), pt)
21212121
else if (wtp.isImplicit)
21222122
err.typeMismatch(tree, pt)
21232123
else
@@ -2221,7 +2221,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22212221
val prevConstraint = ctx.typerState.constraint
22222222
if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits]) tree
22232223
else if (isFullyDefined(wtp, force = ForceDegree.all) &&
2224-
ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt, original)
2224+
ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt)
22252225
else err.typeMismatch(tree, pt, failure)
22262226
}
22272227
}
@@ -2258,7 +2258,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22582258
pt match {
22592259
case pt: FunProto
22602260
if pt.args.lengthCompare(1) > 0 && isUnary(ref) && ctx.canAutoTuple =>
2261-
adaptInterpolated(tree, pt.tupled, original)
2261+
adaptInterpolated(tree, pt.tupled)
22622262
case _ =>
22632263
adaptOverloaded(ref)
22642264
}
@@ -2271,7 +2271,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22712271
}
22722272
if (typeArgs.isEmpty) typeArgs = constrained(poly, tree)._2
22732273
convertNewGenericArray(
2274-
adaptInterpolated(tree.appliedToTypeTrees(typeArgs), pt, original))
2274+
adaptInterpolated(tree.appliedToTypeTrees(typeArgs), pt))
22752275
}
22762276
case wtp =>
22772277
if (isStructuralTermSelect(tree)) adapt(handleStructural(tree), pt)

0 commit comments

Comments
 (0)