Skip to content

Commit 8fd1ef6

Browse files
committed
Drop withPosOf and withSourcePos
Replace by withSpan
1 parent f5e226d commit 8fd1ef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+111
-131
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ object desugar {
113113
def derivedTypeParam(tdef: TypeDef, suffix: String = "")(implicit ctx: Context): TypeDef =
114114
cpy.TypeDef(tdef)(
115115
name = tdef.name ++ suffix,
116-
rhs = new DerivedFromParamTree(suffix).withPosOf(tdef.rhs).watching(tdef)
116+
rhs = new DerivedFromParamTree(suffix).withSpan(tdef.rhs.span).watching(tdef)
117117
)
118118

119119
/** A derived type definition watching `sym` */
@@ -123,7 +123,7 @@ object desugar {
123123
/** A value definition copied from `vdef` with a tpt typetree derived from it */
124124
def derivedTermParam(vdef: ValDef)(implicit ctx: Context): ValDef =
125125
cpy.ValDef(vdef)(
126-
tpt = new DerivedFromParamTree("").withPosOf(vdef.tpt).watching(vdef))
126+
tpt = new DerivedFromParamTree("").withSpan(vdef.tpt.span).watching(vdef))
127127

128128
// ----- Desugar methods -------------------------------------------------
129129

@@ -564,7 +564,7 @@ object desugar {
564564
ModuleDef(
565565
className.toTermName, Template(emptyConstructor, parentTpt :: Nil, EmptyValDef, defs))
566566
.withMods(companionMods | Synthetic))
567-
.withPosOf(cdef).toList
567+
.withSpan(cdef.span).toList
568568

569569
val companionMembers = defaultGetters ::: eqInstances ::: enumCases
570570

@@ -653,7 +653,7 @@ object desugar {
653653
// we can reuse the constructor parameters; no derived params are needed.
654654
DefDef(className.toTermName, constrTparams, constrVparamss, classTypeRef, creatorExpr)
655655
.withMods(companionMods | Synthetic | Implicit)
656-
.withPosOf(cdef) :: Nil
656+
.withSpan(cdef.span) :: Nil
657657

658658
val self1 = {
659659
val selfType = if (self.tpt.isEmpty) classTypeRef else self.tpt
@@ -720,7 +720,7 @@ object desugar {
720720
val clsTmpl = cpy.Template(impl)(self = clsSelf, body = impl.body)
721721
val cls = TypeDef(clsName, clsTmpl)
722722
.withMods(mods.toTypeFlags & RetainedModuleClassFlags | ModuleClassCreationFlags)
723-
Thicket(modul, classDef(cls).withPosOf(mdef))
723+
Thicket(modul, classDef(cls).withSpan(mdef.span))
724724
}
725725
}
726726

@@ -856,7 +856,7 @@ object desugar {
856856
/** Expand variable identifier x to x @ _ */
857857
def patternVar(tree: Tree)(implicit ctx: Context): Bind = {
858858
val Ident(name) = tree
859-
Bind(name, Ident(nme.WILDCARD)).withPosOf(tree)
859+
Bind(name, Ident(nme.WILDCARD)).withSpan(tree.span)
860860
}
861861

862862
def defTree(tree: Tree)(implicit ctx: Context): Tree = tree match {
@@ -988,7 +988,7 @@ object desugar {
988988
val vdefs =
989989
params.zipWithIndex.map{
990990
case (param, idx) =>
991-
DefDef(param.name, Nil, Nil, TypeTree(), selector(idx)).withPosOf(param)
991+
DefDef(param.name, Nil, Nil, TypeTree(), selector(idx)).withSpan(param.span)
992992
}
993993
Function(param :: Nil, Block(vdefs, body))
994994
}
@@ -1282,7 +1282,7 @@ object desugar {
12821282
finalizer)
12831283
}
12841284
}
1285-
desugared.withPosOf(tree)
1285+
desugared.withSpan(tree.span)
12861286
}
12871287

12881288
/** Create a class definition with the same info as the refined type given by `parent`

compiler/src/dotty/tools/dotc/ast/Positioned.scala

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,6 @@ abstract class Positioned(implicit @transientParam src: SourceFile) extends Prod
5959
newpd
6060
}
6161

62-
def withPosOf(posd: Positioned): this.type = {
63-
val ownSpan = this.span
64-
val newpd: this.type =
65-
if ((posd.source `eq` source) && posd.span == ownSpan || ownSpan.isSynthetic) this
66-
else cloneIn(posd.source)
67-
newpd.setPos(posd.span, posd.source)
68-
newpd
69-
}
70-
71-
def withSourcePos(sourcePos: SourcePosition): this.type = {
72-
val ownSpan = this.span
73-
val newpd: this.type =
74-
if ((sourcePos.source `eq` source) && sourcePos.span == ownSpan || ownSpan.isSynthetic) this
75-
else cloneIn(sourcePos.source)
76-
newpd.setPos(sourcePos.span, sourcePos.source)
77-
newpd
78-
}
79-
8062
/** Set span of this tree only, without updating children spans.
8163
* Called from Unpickler when entering positions.
8264
*/

compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TreeTypeMap(
8989
case tree1 =>
9090
tree1.withType(mapType(tree1.tpe)) match {
9191
case id: Ident if tpd.needsSelect(id.tpe) =>
92-
ref(id.tpe.asInstanceOf[TermRef]).withPosOf(id)
92+
ref(id.tpe.asInstanceOf[TermRef]).withSpan(id.span)
9393
case ddef @ DefDef(name, tparams, vparamss, tpt, _) =>
9494
val (tmap1, tparams1) = transformDefs(ddef.tparams)
9595
val (tmap2, vparamss1) = tmap1.transformVParamss(vparamss)
@@ -122,7 +122,7 @@ class TreeTypeMap(
122122
val expr1 = tmap.transform(expr)
123123
cpy.Labeled(labeled)(bind1, expr1)
124124
case Hole(n, args) =>
125-
Hole(n, args.mapConserve(transform)).withPosOf(tree).withType(mapType(tree.tpe))
125+
Hole(n, args.mapConserve(transform)).withSpan(tree.span).withType(mapType(tree.tpe))
126126
case tree1 =>
127127
super.transform(tree1)
128128
}

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ object Trees {
8989
/** Copy `tpe` attribute from tree `from` into this tree, independently
9090
* whether it is null or not.
9191
final def copyAttr[U >: Untyped](from: Tree[U]): ThisTree[T] = {
92-
val t1 = this.withPosOf(from)
92+
val t1 = this.withSpan(from.span)
9393
val t2 =
9494
if (from.myTpe != null) t1.withType(from.myTpe.asInstanceOf[Type])
9595
else t1
@@ -807,10 +807,6 @@ object Trees {
807807

808808
override def withSpan(span: Span): this.type =
809809
mapElems(_.withSpan(span)).asInstanceOf[this.type]
810-
override def withPosOf(posd: Positioned): this.type =
811-
mapElems(_.withPosOf(posd)).asInstanceOf[this.type]
812-
override def withSourcePos(sourcePos: SourcePosition): this.type =
813-
mapElems(_.withSourcePos(sourcePos)).asInstanceOf[this.type]
814810
}
815811

816812
class EmptyTree[T >: Untyped] extends Thicket(Nil)(NoSource) {
@@ -978,10 +974,10 @@ object Trees {
978974
protected def postProcess(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T]
979975

980976
protected def finalize(tree: Tree, copied: untpd.Tree): copied.ThisTree[T] =
981-
postProcess(tree, copied.withPosOf(tree).withAttachmentsFrom(tree))
977+
postProcess(tree, copied.withSpan(tree.span).withAttachmentsFrom(tree))
982978

983979
protected def finalize(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T] =
984-
postProcess(tree, copied.withPosOf(tree).withAttachmentsFrom(tree))
980+
postProcess(tree, copied.withSpan(tree.span).withAttachmentsFrom(tree))
985981

986982
protected def srcCtx(tree: Tree)(implicit ctx: Context) = ctx.withSource(tree.source)
987983

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
10121012
tree
10131013
else {
10141014
ctx.warning(i"conversion from ${tree.tpe.widen} to ${numericCls.typeRef} will always fail at runtime.")
1015-
Throw(New(defn.ClassCastExceptionClass.typeRef, Nil)).withPosOf(tree)
1015+
Throw(New(defn.ClassCastExceptionClass.typeRef, Nil)).withSpan(tree.span)
10161016
}
10171017
}
10181018

@@ -1201,7 +1201,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
12011201
// Give a zero-extent position to the qualifier to prevent it from being included several
12021202
// times in results in the language server.
12031203
val noPosExpr = focusPositions(imp.expr)
1204-
val selectTree = Select(noPosExpr, sym.name).withPosOf(id)
1204+
val selectTree = Select(noPosExpr, sym.name).withSpan(id.span)
12051205
rename match {
12061206
case None =>
12071207
selectTree :: Nil
@@ -1210,7 +1210,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
12101210
// node with the new name and the type of the real symbol.
12111211
val name = if (sym.name.isTypeName) rename.name.toTypeName else rename.name
12121212
val actual = Select(noPosExpr, sym.name)
1213-
val renameTree = Select(noPosExpr, name).withPosOf(rename).withType(actual.tpe)
1213+
val renameTree = Select(noPosExpr, name).withSpan(rename.span).withType(actual.tpe)
12141214
selectTree :: renameTree :: Nil
12151215
}
12161216
}

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
325325
(tycon, targs)
326326
case TypedSplice(tpt1: tpd.Tree) =>
327327
val argTypes = tpt1.tpe.dealias.argTypesLo
328-
def wrap(tpe: Type) = TypeTree(tpe).withPosOf(tpt)
328+
def wrap(tpe: Type) = TypeTree(tpe).withSpan(tpt.span)
329329
(tpt, argTypes.map(wrap))
330330
case _ =>
331331
(tpt, Nil)

compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ object PickledQuotes {
140140
new TreeTypeMap(
141141
oldOwners = ddef.symbol :: Nil,
142142
newOwners = ctx.owner :: Nil,
143-
treeMap = tree => paramToVals.get(tree.symbol).map(_.withPosOf(tree)).getOrElse(tree)
143+
treeMap = tree => paramToVals.get(tree.symbol).map(_.withSpan(tree.span)).getOrElse(tree)
144144
).transform(ddef.rhs)
145145
case Block(stats, expr) =>
146146
seq(stats, rec(expr))

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ class TreeUnpickler(reader: TastyReader,
10311031

10321032
def readQualId(): (untpd.Ident, TypeRef) = {
10331033
val qual = readTerm().asInstanceOf[untpd.Ident]
1034-
(untpd.Ident(qual.name).withPosOf(qual), qual.tpe.asInstanceOf[TypeRef])
1034+
(untpd.Ident(qual.name).withSpan(qual.span), qual.tpe.asInstanceOf[TypeRef])
10351035
}
10361036

10371037
def accessibleDenot(pre: Type, name: Name, sig: Signature) = {

compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ object JavaParsers {
225225
/** Convert (qual)ident to type identifier
226226
*/
227227
def convertToTypeId(tree: Tree): Tree = convertToTypeName(tree) match {
228-
case Some(t) => t.withPosOf(tree)
228+
case Some(t) => t.withSpan(tree.span)
229229
case _ => tree match {
230230
case AppliedTypeTree(_, _) | Select(_, _) =>
231231
tree

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ object Parsers {
367367
*/
368368
def convertToParam(tree: Tree, mods: Modifiers = Modifiers(), expected: String = "formal parameter"): ValDef = tree match {
369369
case Ident(name) =>
370-
makeParameter(name.asTermName, TypeTree(), mods).withPosOf(tree)
370+
makeParameter(name.asTermName, TypeTree(), mods).withSpan(tree.span)
371371
case Typed(Ident(name), tpt) =>
372-
makeParameter(name.asTermName, tpt, mods).withPosOf(tree)
372+
makeParameter(name.asTermName, tpt, mods).withSpan(tree.span)
373373
case _ =>
374374
syntaxError(s"not a legal $expected", tree.span)
375375
makeParameter(nme.ERROR, tree, mods)
@@ -2590,11 +2590,11 @@ object Parsers {
25902590
if (in.token == ARROW) {
25912591
first match {
25922592
case Typed(tree @ This(EmptyTypeIdent), tpt) =>
2593-
self = makeSelfDef(nme.WILDCARD, tpt).withPosOf(first)
2593+
self = makeSelfDef(nme.WILDCARD, tpt).withSpan(first.span)
25942594
case _ =>
25952595
val ValDef(name, tpt, _) = convertToParam(first, EmptyModifiers, "self type clause")
25962596
if (name != nme.ERROR)
2597-
self = makeSelfDef(name, tpt).withPosOf(first)
2597+
self = makeSelfDef(name, tpt).withSpan(first.span)
25982598
}
25992599
in.nextToken()
26002600
} else {

compiler/src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TreeBuilder(implicit ctx: Context) {
4242
case Ident(name) if isVarPattern(tree) && name != nme.WILDCARD =>
4343
Bind(
4444
name, Ident(nme.WILDCARD).withPos(tree.pos.focus)
45-
).withPosOf(tree)
45+
).withSpan(tree.span)
4646
case Typed(id @ Ident(name), tpt) if isVarPattern(id) && name != nme.WILDCARD =>
4747
Bind(
4848
name,

compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsTreesOpsImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ trait TypeOrBoundsTreesOpsImpl extends scala.tasty.reflect.TypeOrBoundsTreeOps w
407407
// TODO only enums generate this kind of type bounds. Is this possible without enums? If not generate tpd.TypeBoundsTree for enums instead
408408
x.tpe match {
409409
case tpe: Types.TypeBounds =>
410-
Some(tpd.TypeBoundsTree(tpd.TypeTree(tpe.lo).withPosOf(x), tpd.TypeTree(tpe.hi).withPosOf(x)))
410+
Some(tpd.TypeBoundsTree(tpd.TypeTree(tpe.lo).withSpan(x.span), tpd.TypeTree(tpe.hi).withSpan(x.span)))
411411
case _ => None
412412
}
413413
case _ => None

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ abstract class AccessProxies {
9797
case Select(qual, _) if qual.tpe.derivesFrom(accessor.owner) => qual.select(accessor)
9898
case _ => ref(accessor)
9999
}
100-
}.withPosOf(reference)
100+
}.withSpan(reference.span)
101101

102102
/** Given a reference to a getter accessor, the corresponding setter reference */
103103
def useSetter(getterRef: Tree)(implicit ctx: Context): Tree = getterRef match {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ByNameClosures extends TransformByNameApply with IdentityDenotTransformer
2828
override def mkByNameClosure(arg: Tree, argType: Type)(implicit ctx: Context): Tree = {
2929
val meth = ctx.newSymbol(
3030
ctx.owner, nme.ANON_FUN, Synthetic | Method, MethodType(Nil, Nil, argType))
31-
Closure(meth, _ => arg.changeOwnerAfter(ctx.owner, meth, thisPhase)).withPosOf(arg)
31+
Closure(meth, _ => arg.changeOwnerAfter(ctx.owner, meth, thisPhase)).withSpan(arg.span)
3232
}
3333
}
3434

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class CapturedVars extends MiniPhase with IdentityDenotTransformer { thisPhase =
107107
ref(vble.info.classSymbol.companionModule.info.member(name).symbol)
108108
cpy.ValDef(vdef)(
109109
rhs = boxMethod(nme.create).appliedTo(vdef.rhs),
110-
tpt = TypeTree(vble.info).withPosOf(vdef.tpt))
110+
tpt = TypeTree(vble.info).withSpan(vdef.tpt.span))
111111
} else vdef
112112
}
113113

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ClassOf extends MiniPhase {
2121
override def transformTypeApply(tree: TypeApply)(implicit ctx: Context): Tree =
2222
if (tree.symbol eq defn.Predef_classOf) {
2323
val targ = tree.args.head.tpe
24-
clsOf(targ).ensureConforms(tree.tpe).withPosOf(tree)
24+
clsOf(targ).ensureConforms(tree.tpe).withSpan(tree.span)
2525
}
2626
else tree
2727
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
149149
case Ident(_) | Select(This(_), _) =>
150150
var sym = tree.symbol
151151
if (sym is (ParamAccessor, butNot = Mutable)) sym = sym.subst(accessors, paramSyms)
152-
if (sym.owner.isConstructor) ref(sym).withPosOf(tree) else tree
152+
if (sym.owner.isConstructor) ref(sym).withSpan(tree.span) else tree
153153
case Apply(fn, Nil) =>
154154
val fn1 = transform(fn)
155155
if ((fn1 ne fn) && fn1.symbol.is(Param) && fn1.symbol.owner.isPrimaryConstructor)
@@ -195,7 +195,7 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
195195
val sym = stat.symbol
196196
if (isRetained(sym)) {
197197
if (!stat.rhs.isEmpty && !isWildcardArg(stat.rhs))
198-
constrStats += Assign(ref(sym), intoConstr(stat.rhs, sym)).withPosOf(stat)
198+
constrStats += Assign(ref(sym), intoConstr(stat.rhs, sym)).withSpan(stat.span)
199199
clsStats += cpy.ValDef(stat)(rhs = EmptyTree)
200200
}
201201
else if (!stat.rhs.isEmpty) {
@@ -230,7 +230,7 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
230230
if (!target.exists) Nil // this case arises when the parameter accessor is an alias
231231
else {
232232
val param = acc.subst(accessors, paramSyms)
233-
val assigns = Assign(ref(target), ref(param)).withPosOf(tree) :: Nil
233+
val assigns = Assign(ref(target), ref(param)).withSpan(tree.span) :: Nil
234234
if (acc.name != nme.OUTER) assigns
235235
else {
236236
// insert test: if ($outer eq null) throw new NullPointerException

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ object Erasure {
180180
}
181181

182182
def constant(tree: Tree, const: Tree)(implicit ctx: Context): Tree =
183-
(if (isPureExpr(tree)) const else Block(tree :: Nil, const)).withPosOf(tree)
183+
(if (isPureExpr(tree)) const else Block(tree :: Nil, const)).withSpan(tree.span)
184184

185185
final def box(tree: Tree, target: => String = "")(implicit ctx: Context): Tree = trace(i"boxing ${tree.showSummary}: ${tree.tpe} into $target") {
186186
tree.tpe.widen match {
@@ -558,7 +558,7 @@ object Erasure {
558558
if (sym.isEffectivelyErased) erasedDef(sym)
559559
else
560560
super.typedValDef(untpd.cpy.ValDef(vdef)(
561-
tpt = untpd.TypedSplice(TypeTree(sym.info).withPosOf(vdef.tpt))), sym)
561+
tpt = untpd.TypedSplice(TypeTree(sym.info).withSpan(vdef.tpt.span))), sym)
562562

563563
/** Besides normal typing, this function also compacts anonymous functions
564564
* with more than `MaxImplementedFunctionArity` parameters to use a single
@@ -591,7 +591,7 @@ object Erasure {
591591
val ddef1 = untpd.cpy.DefDef(ddef)(
592592
tparams = Nil,
593593
vparamss = vparamss1,
594-
tpt = untpd.TypedSplice(TypeTree(restpe).withPosOf(ddef.tpt)),
594+
tpt = untpd.TypedSplice(TypeTree(restpe).withSpan(ddef.tpt.span)),
595595
rhs = rhs1)
596596
super.typedDefDef(ddef1, sym)
597597
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase =>
105105
parent
106106
}
107107
else parent match { // ensure class parent is a constructor
108-
case parent: TypeTree => New(parent.tpe, Nil).withPosOf(impl)
108+
case parent: TypeTree => New(parent.tpe, Nil).withSpan(impl.span)
109109
case _ => parent
110110
}
111111
}
@@ -359,7 +359,7 @@ object ExplicitOuter {
359359
}
360360
if (hasOuterParam(cls))
361361
methPart(fun) match {
362-
case Select(receiver, _) => outerArg(receiver).withPosOf(fun) :: Nil
362+
case Select(receiver, _) => outerArg(receiver).withSpan(fun.span) :: Nil
363363
}
364364
else Nil
365365
} else Nil

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ExplicitSelf extends MiniPhase {
2929
override def transformIdent(tree: Ident)(implicit ctx: Context): Tree = tree.tpe match {
3030
case tp: ThisType =>
3131
ctx.debuglog(s"owner = ${ctx.owner}, context = ${ctx}")
32-
This(tp.cls).withPosOf(tree)
32+
This(tp.cls).withSpan(tree.span)
3333
case _ => tree
3434
}
3535

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class FirstTransform extends MiniPhase with InfoTransformer { thisPhase =>
107107
if (meth.hasAnnotation(defn.NativeAnnot)) {
108108
meth.resetFlag(Deferred)
109109
polyDefDef(meth,
110-
_ => _ => ref(defn.Sys_errorR).withPosOf(ddef)
110+
_ => _ => ref(defn.Sys_errorR).withSpan(ddef.span)
111111
.appliedTo(Literal(Constant(s"native method stub"))))
112112

113113
}
@@ -133,7 +133,7 @@ class FirstTransform extends MiniPhase with InfoTransformer { thisPhase =>
133133
*/
134134
private def toTypeTree(tree: Tree)(implicit ctx: Context) = {
135135
val binders = collectBinders.apply(Nil, tree)
136-
val result: Tree = TypeTree(tree.tpe).withPosOf(tree)
136+
val result: Tree = TypeTree(tree.tpe).withSpan(tree.span)
137137
(result /: binders)(Annotated(_, _))
138138
}
139139

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ trait FullParameterization {
240240
ref(vparam.symbol).ensureConforms(paramType)
241241
}))
242242
})
243-
}).withPosOf(originalDef.rhs)
243+
}).withSpan(originalDef.rhs.span)
244244
}
245245
}
246246

0 commit comments

Comments
 (0)