Skip to content

Commit 23a5d0f

Browse files
committed
Add missing spans in Desugar
1 parent 85094bd commit 23a5d0f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ object desugar {
142142
// val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos?
143143
// right now vdef maps via expandedTree to a thicket which concerns itself.
144144
// I don't see a problem with that but if there is one we can avoid it by making a copy here.
145-
val setterParam = makeSyntheticParameter(tpt = (new SetterParamTree).watching(vdef))
145+
val setterParam = makeSyntheticParameter(tpt = (new SetterParamTree).watching(vdef)).withSpan(vdef.span)
146146
// The rhs gets filled in later, when field is generated and getter has parameters (see Memoize miniphase)
147-
val setterRhs = if (vdef.rhs.isEmpty) EmptyTree else unitLiteral
147+
val setterRhs = if (vdef.rhs.isEmpty) EmptyTree else unitLiteral.withSpan(vdef.rhs.span)
148148
val setter = cpy.DefDef(vdef)(
149149
name = name.setterName,
150150
tparams = Nil,
@@ -500,7 +500,7 @@ object desugar {
500500
} :+ defaultCase
501501
val body = Match(paramRef, patternMatchCases)
502502
DefDef(nme.productElementName, Nil, List(List(methodParam)), javaDotLangDot(tpnme.String), body)
503-
.withFlags(if (defn.isNewCollections) Override | Synthetic else Synthetic)
503+
.withFlags(if (defn.isNewCollections) Override | Synthetic else Synthetic).withSpan(cdef.span)
504504
}
505505

506506
if (isCaseClass)
@@ -514,7 +514,7 @@ object desugar {
514514
if (isEnumCase && parents.isEmpty)
515515
parents1 = enumClassTypeRef :: Nil
516516
if (isCaseClass | isCaseObject)
517-
parents1 = parents1 :+ scalaDot(str.Product.toTypeName)
517+
parents1 = parents1 :+ scalaDot(str.Product.toTypeName).withSpan(cdef.span)
518518
if (isEnum)
519519
parents1 = parents1 :+ ref(defn.EnumType)
520520

@@ -719,7 +719,7 @@ object desugar {
719719
.withSpan(impl.self.span.orElse(impl.span.startPos))
720720
val clsTmpl = cpy.Template(impl)(self = clsSelf, body = impl.body)
721721
val cls = TypeDef(clsName, clsTmpl)
722-
.withMods(mods.toTypeFlags & RetainedModuleClassFlags | ModuleClassCreationFlags)
722+
.withMods(mods.toTypeFlags & RetainedModuleClassFlags | ModuleClassCreationFlags).withSpan(mdef.span)
723723
Thicket(modul, classDef(cls).withSpan(mdef.span))
724724
}
725725
}
@@ -830,7 +830,7 @@ object desugar {
830830
val caseDef = CaseDef(pat, EmptyTree, makeTuple(ids))
831831
val matchExpr =
832832
if (forallResults(rhs, isMatchingTuple)) rhs
833-
else Match(rhsUnchecked, caseDef :: Nil)
833+
else Match(rhsUnchecked, caseDef :: Nil).withSpan(original.span)
834834
vars match {
835835
case Nil =>
836836
matchExpr

0 commit comments

Comments
 (0)