Skip to content

Commit 92419dd

Browse files
committed
Rename withSourcePos -> withPos
1 parent 6aefbbc commit 92419dd

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ abstract class Positioned(implicit @transientParam src: SourceFile) extends Prod
6868
newpd
6969
}
7070

71-
def withSourcePos(sourcePos: Position): this.type = {
71+
def withPos(pos: Position): this.type = {
7272
val ownSpan = this.span
7373
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)
74+
if ((pos.source `eq` source) && pos.span == ownSpan || ownSpan.isSynthetic) this
75+
else cloneIn(pos.source)
76+
newpd.setPos(pos.span, pos.source)
7777
newpd
7878
}
7979

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,8 @@ object Trees {
809809
mapElems(_.withSpan(span)).asInstanceOf[this.type]
810810
override def withPosOf(posd: Positioned): this.type =
811811
mapElems(_.withPosOf(posd)).asInstanceOf[this.type]
812-
override def withSourcePos(sourcePos: Position): this.type =
813-
mapElems(_.withSourcePos(sourcePos)).asInstanceOf[this.type]
812+
override def withPos(pos: Position): this.type =
813+
mapElems(_.withPos(pos)).asInstanceOf[this.type]
814814
}
815815

816816
class EmptyTree[T >: Untyped] extends Thicket(Nil)(NoSource) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ object Inliner {
160160
* The trace has enough info to completely reconstruct positions.
161161
*/
162162
def inlineCallTrace(callSym: Symbol, pos: Position)(implicit ctx: Context): Tree =
163-
Ident(callSym.topLevelClass.typeRef).withSourcePos(pos)
163+
Ident(callSym.topLevelClass.typeRef).withPos(pos)
164164
}
165165

166166
/** Produces an inlined version of `call` via its `inlined` method.
@@ -235,7 +235,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
235235
val binding = {
236236
if (isByName) DefDef(boundSym, arg.changeOwner(ctx.owner, boundSym))
237237
else ValDef(boundSym, arg)
238-
}.withSourcePos(boundSym.pos)
238+
}.withPos(boundSym.pos)
239239
boundSym.defTree = binding
240240
bindingsBuf += binding
241241
binding
@@ -289,7 +289,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
289289
ref(rhsClsSym.sourceModule)
290290
else
291291
inlineCallPrefix
292-
val binding = ValDef(selfSym.asTerm, rhs).withSourcePos(selfSym.pos)
292+
val binding = ValDef(selfSym.asTerm, rhs).withPos(selfSym.pos)
293293
bindingsBuf += binding
294294
selfSym.defTree = binding
295295
inlining.println(i"proxy at $level: $selfSym = ${bindingsBuf.last}")

tests/plugins/neg/divideZero-research/plugin_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DivideZero extends MiniPhase with ResearchPlugin {
3030

3131
override def transformApply(tree: tpd.Apply)(implicit ctx: Context): tpd.Tree = tree match {
3232
case tpd.Apply(fun, tpd.Literal(Constants.Constant(v)) :: Nil) if isNumericDivide(fun.symbol) && v == 0 =>
33-
ctx.error("divide by zero", tree.sourcePos)
33+
ctx.error("divide by zero", tree.pos)
3434
tree
3535
case _ =>
3636
tree

tests/plugins/neg/divideZero/plugin_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DivideZero extends PluginPhase with StandardPlugin {
3131

3232
override def transformApply(tree: tpd.Apply)(implicit ctx: Context): tpd.Tree = tree match {
3333
case tpd.Apply(fun, tpd.Literal(Constants.Constant(v)) :: Nil) if isNumericDivide(fun.symbol) && v == 0 =>
34-
ctx.error("divide by zero", tree.sourcePos)
34+
ctx.error("divide by zero", tree.pos)
3535
tree
3636
case _ =>
3737
tree

0 commit comments

Comments
 (0)