Skip to content

Commit 8960f44

Browse files
committed
Rename Symbol#sourcePos -> pos
1 parent dc2c818 commit 8960f44

24 files changed

+69
-69
lines changed

compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ object CollectEntryPoints{
4747
def hasJavaMainMethod(sym: Symbol): Boolean =
4848
(toDenot(sym).info member nme.main).alternatives exists(x => isJavaMainMethod(x.symbol))
4949

50-
def fail(msg: String, pos: Position = sym.sourcePos) = {
50+
def fail(msg: String, pos: Position = sym.pos) = {
5151
ctx.warning(
5252
i"""${sym.name} has a main method with parameter type Array[String], but ${sym.fullName} will not be a runnable program.
53-
|Reason: $msg""", sym.sourcePos
53+
|Reason: $msg""", sym.pos
5454
// TODO: make this next claim true, if possible
5555
// by generating valid main methods as static in module classes
5656
// not sure what the jvm allows here
@@ -92,11 +92,11 @@ object CollectEntryPoints{
9292
fail("main methods cannot be generic.")
9393
case MethodTpe(paramNames, paramTypes, resultType) =>
9494
if (resultType :: paramTypes exists (_.typeSymbol.isAbstractType))
95-
fail("main methods cannot refer to type parameters or abstract types.", m.symbol.sourcePos)
95+
fail("main methods cannot refer to type parameters or abstract types.", m.symbol.pos)
9696
else
97-
isJavaMainMethod(m.symbol) || fail("main method must have exact signature (Array[String])Unit", m.symbol.sourcePos)
97+
isJavaMainMethod(m.symbol) || fail("main method must have exact signature (Array[String])Unit", m.symbol.pos)
9898
case tp =>
99-
fail(s"don't know what this is: $tp", m.symbol.sourcePos)
99+
fail(s"don't know what this is: $tp", m.symbol.pos)
100100
}
101101
}
102102
}

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
504504
i"""|compiler bug: created invalid generic signature for $sym in ${sym.denot.owner.showFullName}
505505
|signature: $sig
506506
|if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
507-
""".trim, sym.sourcePos)
507+
""".trim, sym.pos)
508508
}
509509
}
510510

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
163163
else (dupClassSym, classSymbol)
164164
ctx.atPhase(ctx.typerPhase) { implicit ctx =>
165165
ctx.warning(s"${cl1.show} differs only in case from ${cl2.showLocated}. " +
166-
"Such classes will overwrite one another on case-insensitive filesystems.", cl1.sourcePos)
166+
"Such classes will overwrite one another on case-insensitive filesystems.", cl1.pos)
167167
}
168168
}
169169
}

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ object SymDenotations {
21082108
def complete(denot: SymDenotation)(implicit ctx: Context): Unit = {
21092109
val sym = denot.symbol
21102110
def errMsg = BadSymbolicReference(denot)
2111-
ctx.error(errMsg, sym.sourcePos)
2111+
ctx.error(errMsg, sym.pos)
21122112
if (ctx.debug) throw new scala.Error()
21132113
initializeToDefaults(denot, errMsg)
21142114
}

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ object Symbols {
661661
*/
662662
final def span: Span = if (coord.isSpan) coord.toSpan else NoSpan
663663

664-
final def sourcePos(implicit ctx: Context): Position = {
664+
final def pos(implicit ctx: Context): Position = {
665665
val src = source
666666
(if (src.exists) src else ctx.source).atSpan(span)
667667
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class TreePickler(pickler: TastyPickler) {
8080
// I believe it's a bug in typer: the type of an implicit argument refers
8181
// to a closure parameter outside the closure itself. TODO: track this down, so that we
8282
// can eliminate this case.
83-
ctx.log(i"pickling reference to as yet undefined $sym in ${sym.owner}", sym.sourcePos)
83+
ctx.log(i"pickling reference to as yet undefined $sym in ${sym.owner}", sym.pos)
8484
pickleForwardSymRef(sym)
8585
}
8686

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
609609
}
610610
if (ctx.settings.YprintPosSyms.value && tree.isDef)
611611
txt = (txt ~
612-
s"@@(${tree.symbol.name}=" ~ tree.symbol.sourcePos.toString ~ ")").close
612+
s"@@(${tree.symbol.name}=" ~ tree.symbol.pos.toString ~ ")").close
613613
}
614614
if (ctx.settings.YshowTreeIds.value)
615615
txt = (txt ~ "#" ~ tree.uniqueId.toString).close

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2103,7 +2103,7 @@ object messages {
21032103
case _ /* Signature.FullMatch */ => "\nThe definitions have matching type signatures after erasure."
21042104
}
21052105
} else ""
2106-
hl"${decl.showLocated} is already defined as ${previousDecl.showDcl} ${if (previousDecl.span.exists) s"at line ${previousDecl.sourcePos.line + 1}" else ""}." + details
2106+
hl"${decl.showLocated} is already defined as ${previousDecl.showDcl} ${if (previousDecl.span.exists) s"at line ${previousDecl.pos.line + 1}" else ""}." + details
21072107
}
21082108
val explanation: String = ""
21092109
}

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
246246
case ex: TypeError =>
247247
// See neg/i1750a for an example where a cyclic error can arise.
248248
// The root cause in this example is an illegal "override" of an inner trait
249-
ctx.error(ex.toMessage, csym.sourcePos)
249+
ctx.error(ex.toMessage, csym.pos)
250250
defn.ObjectType :: Nil
251251
}
252252
if (ValueClasses.isDerivedValueClass(csym)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait SymbolOpsImpl extends scala.tasty.reflect.SymbolOps with CoreImpl {
2626
def name(implicit ctx: Context): String = symbol.name.toString
2727
def fullName(implicit ctx: Context): String = symbol.fullName.toString
2828

29-
def pos(implicit ctx: Context): Position = symbol.sourcePos
29+
def pos(implicit ctx: Context): Position = symbol.pos
3030

3131
def owner(implicit ctx: Context): Symbol = symbol.owner
3232

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Bridges(root: ClassSymbol, thisPhase: DenotTransformer)(implicit ctx: Cont
4242
private val bridgeTarget = newMutableSymbolMap[Symbol]
4343

4444
def bridgePosFor(member: Symbol): Position =
45-
(if (member.owner == root && member.span.exists) member else root).sourcePos
45+
(if (member.owner == root && member.span.exists) member else root).pos
4646

4747
/** Add a bridge between `member` and `other`, where `member` overrides `other`
4848
* before erasure, if the following conditions are satisfied.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class CollectEntryPoints extends MiniPhase {
3838
}
3939

4040
def isJavaEntryPoint(sym: Symbol)(implicit ctx: Context): Boolean = {
41-
def fail(msg: String, pos: Position = sym.sourcePos) = {
41+
def fail(msg: String, pos: Position = sym.pos) = {
4242
ctx.warning(
4343
i"""${sym.name} has a main method with parameter type Array[String], but ${sym.fullName} will not be a runnable program.
44-
|Reason: $msg""", sym.sourcePos
44+
|Reason: $msg""", sym.pos
4545
// TODO: make this next claim true, if possible
4646
// by generating valid main methods as static in module classes
4747
// not sure what the jvm allows here
@@ -80,11 +80,11 @@ class CollectEntryPoints extends MiniPhase {
8080
fail("main methods cannot be generic.")
8181
case t: MethodType =>
8282
if (t.resultType :: t.paramInfos exists (_.typeSymbol.isAbstractType))
83-
fail("main methods cannot refer to type parameters or abstract types.", m.symbol.sourcePos)
83+
fail("main methods cannot refer to type parameters or abstract types.", m.symbol.pos)
8484
else
85-
ctx.platform.isMainMethod(m.symbol) || fail("main method must have exact signature (Array[String])Unit", m.symbol.sourcePos)
85+
ctx.platform.isMainMethod(m.symbol) || fail("main method must have exact signature (Array[String])Unit", m.symbol.pos)
8686
case tp =>
87-
fail(s"don't know what this is: $tp", m.symbol.sourcePos)
87+
fail(s"don't know what this is: $tp", m.symbol.pos)
8888
}
8989
}
9090
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
225225
Nil
226226
} else {
227227
if (acc.hasAnnotation(defn.TransientParamAnnot))
228-
ctx.error(em"transient parameter $acc is retained as field in class ${acc.owner}", acc.sourcePos)
228+
ctx.error(em"transient parameter $acc is retained as field in class ${acc.owner}", acc.pos)
229229
val target = if (acc.is(Method)) acc.field else acc
230230
if (!target.exists) Nil // this case arises when the parameter accessor is an alias
231231
else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ElimErasedValueType extends MiniPhase with InfoTransformer {
108108
|$sym1: $info1 in ${sym1.owner} and
109109
|$sym2: $info2 in ${sym2.owner}
110110
|have same type after erasure: $info""",
111-
root.sourcePos)
111+
root.pos)
112112
}
113113
val earlyCtx = ctx.withPhase(ctx.elimRepeatedPhase.next)
114114
while (opc.hasNext) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class Mixin extends MiniPhase with SymTransformer { thisPhase =>
211211
ctx.error(
212212
em"""parameterized $mixin is indirectly implemented,
213213
|needs to be implemented directly so that arguments can be passed""",
214-
cls.sourcePos)
214+
cls.pos)
215215
EmptyTree
216216
}
217217

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ object OverridingPairs {
134134
case ex: TypeError =>
135135
// See neg/i1750a for an example where a cyclic error can arise.
136136
// The root cause in this example is an illegal "override" of an inner trait
137-
ctx.error(ex.toMessage, base.sourcePos)
137+
ctx.error(ex.toMessage, base.pos)
138138
}
139139
} else {
140140
curEntry = curEntry.prev

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ class Staging extends MacroTransformWithImplicits {
315315
tp
316316
}
317317
case tp: NamedType =>
318-
check(tp.symbol, tp, tp.symbol.sourcePos)
318+
check(tp.symbol, tp, tp.symbol.pos)
319319
if (!tp.symbol.is(Param))
320320
foldOver(acc, tp)
321321
case tp: ThisType =>
322-
check(tp.cls, tp, tp.cls.sourcePos)
322+
check(tp.cls, tp, tp.cls.pos)
323323
foldOver(acc, tp)
324324
case _ =>
325325
foldOver(acc, tp)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class TailRec extends MiniPhase {
123123
// We don't report a new error if failures were reported
124124
// during the transformation.
125125
if (mandatory && !failureReported)
126-
ctx.error(TailrecNotApplicable(method), method.sourcePos)
126+
ctx.error(TailrecNotApplicable(method), method.pos)
127127

128128
tree
129129
}

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ object Checking {
270270
catch {
271271
case ex: CyclicReference =>
272272
if (reportErrors) {
273-
errorType(i"illegal cyclic reference: ${checker.where} ${checker.lastChecked} of $sym refers back to the type itself", sym.sourcePos)
273+
errorType(i"illegal cyclic reference: ${checker.where} ${checker.lastChecked} of $sym refers back to the type itself", sym.pos)
274274
}
275275
else info
276276
}
@@ -357,7 +357,7 @@ object Checking {
357357

358358
/** Check that symbol's definition is well-formed. */
359359
def checkWellFormed(sym: Symbol)(implicit ctx: Context): Unit = {
360-
def fail(msg: Message) = ctx.error(msg, sym.sourcePos)
360+
def fail(msg: Message) = ctx.error(msg, sym.pos)
361361

362362
def checkWithDeferred(flag: FlagSet) =
363363
if (sym.is(flag))
@@ -523,31 +523,31 @@ object Checking {
523523
}
524524
if (isDerivedValueClass(clazz)) {
525525
if (clazz.is(Trait))
526-
ctx.error(CannotExtendAnyVal(clazz), clazz.sourcePos)
526+
ctx.error(CannotExtendAnyVal(clazz), clazz.pos)
527527
if (clazz.is(Abstract))
528-
ctx.error(ValueClassesMayNotBeAbstract(clazz), clazz.sourcePos)
528+
ctx.error(ValueClassesMayNotBeAbstract(clazz), clazz.pos)
529529
if (!clazz.isStatic)
530-
ctx.error(ValueClassesMayNotBeContainted(clazz), clazz.sourcePos)
530+
ctx.error(ValueClassesMayNotBeContainted(clazz), clazz.pos)
531531
if (isCyclic(clazz.asClass))
532-
ctx.error(ValueClassesMayNotWrapItself(clazz), clazz.sourcePos)
532+
ctx.error(ValueClassesMayNotWrapItself(clazz), clazz.pos)
533533
else {
534534
val clParamAccessors = clazz.asClass.paramAccessors.filter { param =>
535535
param.isTerm && !param.is(Flags.Accessor)
536536
}
537537
clParamAccessors match {
538538
case param :: params =>
539539
if (param.is(Mutable))
540-
ctx.error(ValueClassParameterMayNotBeAVar(clazz, param), param.sourcePos)
540+
ctx.error(ValueClassParameterMayNotBeAVar(clazz, param), param.pos)
541541
if (param.info.isInstanceOf[ExprType])
542-
ctx.error(ValueClassParameterMayNotBeCallByName(clazz, param), param.sourcePos)
542+
ctx.error(ValueClassParameterMayNotBeCallByName(clazz, param), param.pos)
543543
if (param.is(Erased))
544-
ctx.error("value class first parameter cannot be `erased`", param.sourcePos)
544+
ctx.error("value class first parameter cannot be `erased`", param.pos)
545545
else {
546546
for (p <- params if !p.is(Erased))
547-
ctx.error("value class can only have one non `erased` parameter", p.sourcePos)
547+
ctx.error("value class can only have one non `erased` parameter", p.pos)
548548
}
549549
case Nil =>
550-
ctx.error(ValueClassNeedsOneValParam(clazz), clazz.sourcePos)
550+
ctx.error(ValueClassNeedsOneValParam(clazz), clazz.pos)
551551
}
552552
}
553553
stats.foreach(checkValueClassMember)
@@ -614,7 +614,7 @@ trait Checking {
614614
defn.LanguageModuleClass, nme.implicitConversions,
615615
i"Definition of implicit conversion $sym",
616616
ctx.owner.topLevelClass,
617-
sym.sourcePos)
617+
sym.pos)
618618
}
619619

620620
sym.info.stripPoly match {
@@ -741,12 +741,12 @@ trait Checking {
741741
if (decl.matches(other)) {
742742
def doubleDefError(decl: Symbol, other: Symbol): Unit =
743743
if (!decl.info.isErroneous && !other.info.isErroneous)
744-
ctx.error(DoubleDeclaration(decl, other), decl.sourcePos)
744+
ctx.error(DoubleDeclaration(decl, other), decl.pos)
745745
if (decl is Synthetic) doubleDefError(other, decl)
746746
else doubleDefError(decl, other)
747747
}
748748
if ((decl is HasDefaultParams) && (other is HasDefaultParams)) {
749-
ctx.error(em"two or more overloaded variants of $decl have default arguments", decl.sourcePos)
749+
ctx.error(em"two or more overloaded variants of $decl have default arguments", decl.pos)
750750
decl resetFlag HasDefaultParams
751751
}
752752
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.sourcePos)
238+
}.withSourcePos(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.sourcePos)
292+
val binding = ValDef(selfSym.asTerm, rhs).withSourcePos(selfSym.pos)
293293
bindingsBuf += binding
294294
selfSym.defTree = binding
295295
inlining.println(i"proxy at $level: $selfSym = ${bindingsBuf.last}")

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ class Namer { typer: Typer =>
694694
}
695695

696696
def missingType(sym: Symbol, modifier: String)(implicit ctx: Context): Unit = {
697-
ctx.error(s"${modifier}type of implicit definition needs to be given explicitly", sym.sourcePos)
697+
ctx.error(s"${modifier}type of implicit definition needs to be given explicitly", sym.pos)
698698
sym.resetFlag(Implicit)
699699
}
700700

@@ -797,7 +797,7 @@ class Namer { typer: Typer =>
797797
denot.info = typeSig(sym)
798798
invalidateIfClashingSynthetic(denot)
799799
Checking.checkWellFormed(sym)
800-
denot.info = avoidPrivateLeaks(sym, sym.sourcePos)
800+
denot.info = avoidPrivateLeaks(sym, sym.pos)
801801
}
802802
}
803803

@@ -901,9 +901,9 @@ class Namer { typer: Typer =>
901901
else {
902902
val pclazz = pt.typeSymbol
903903
if (pclazz.is(Final))
904-
ctx.error(ExtendFinalClass(cls, pclazz), cls.sourcePos)
904+
ctx.error(ExtendFinalClass(cls, pclazz), cls.pos)
905905
if (pclazz.is(Sealed) && pclazz.associatedFile != cls.associatedFile)
906-
ctx.error(UnableToExtendSealedClass(pclazz), cls.sourcePos)
906+
ctx.error(UnableToExtendSealedClass(pclazz), cls.pos)
907907
pt
908908
}
909909
}
@@ -971,7 +971,7 @@ class Namer { typer: Typer =>
971971

972972
Checking.checkWellFormed(cls)
973973
if (isDerivedValueClass(cls)) cls.setFlag(Final)
974-
cls.info = avoidPrivateLeaks(cls, cls.sourcePos)
974+
cls.info = avoidPrivateLeaks(cls, cls.pos)
975975
cls.baseClasses.foreach(_.invalidateBaseTypeCache()) // we might have looked before and found nothing
976976
cls.setNoInitsFlags(parentsKind(parents), bodyKind(rest))
977977
if (cls.isNoInitsClass) cls.primaryConstructor.setFlag(Stable)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ object PrepareInlineable {
243243

244244
def checkInlineMethod(inlined: Symbol, body: Tree)(implicit ctx: Context): Unit = {
245245
if (ctx.outer.inInlineMethod)
246-
ctx.error(ex"implementation restriction: nested inline methods are not supported", inlined.sourcePos)
246+
ctx.error(ex"implementation restriction: nested inline methods are not supported", inlined.pos)
247247
if (inlined.name == nme.unapply && tupleArgs(body).isEmpty)
248248
ctx.warning(
249249
em"inline unapply method can be rewritten only if its right hand side is a tuple (e1, ..., eN)",

0 commit comments

Comments
 (0)