Skip to content

Commit f4b2c9a

Browse files
committed
Fix pickling positions problem
Make parameter definitions in DefDef have the same span as the symbols they define. Previously, this position was not set, which means it would be set pretty much in an ad-hoc way based on the positions that were set in the definitions environment. For some reason I cannot quite reconstruct, the changes to opaque caused pos/exports.scala to fail pickling tests because an extension parameter symbol symbol a different position after pickling.
1 parent babae72 commit f4b2c9a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
206206
def DefDef(sym: TermSymbol, tparams: List[TypeSymbol], vparamss: List[List[TermSymbol]],
207207
resultType: Type, rhs: Tree)(implicit ctx: Context): DefDef =
208208
ta.assignType(
209-
untpd.DefDef(sym.name, tparams map TypeDef, vparamss.nestedMap(ValDef(_)),
210-
TypeTree(resultType), rhs),
209+
untpd.DefDef(
210+
sym.name,
211+
tparams.map(tparam => TypeDef(tparam).withSpan(tparam.span)),
212+
vparamss.nestedMap(vparam => ValDef(vparam).withSpan(vparam.span)),
213+
TypeTree(resultType),
214+
rhs),
211215
sym)
212216

213217
def DefDef(sym: TermSymbol, rhs: Tree = EmptyTree)(implicit ctx: Context): DefDef =

0 commit comments

Comments
 (0)