Skip to content

Commit 833d329

Browse files
committed
Add missing spans
1 parent e16dcde commit 833d329

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ private[typer] final class PossiblyHoistedValue private (representation: tpd.Tre
5050

5151
/** Returns a tree representing the value of `self` along with its hoisted definition, if any. */
5252
def valueAndDefinition(using Context): (tpd.Tree, Option[tpd.ValDef]) =
53-
definition
54-
.map((d) => (tpd.Ident(d.namedType), Some(d)))
55-
.getOrElse((representation, None))
53+
definition match
54+
case Some(d) => (tpd.Ident(d.namedType).withSpan(representation.span), Some(d))
55+
case _ => (representation, None)
5656

5757
object PossiblyHoistedValue:
5858

@@ -61,7 +61,7 @@ object PossiblyHoistedValue:
6161
if isSingleAssignment || (tpd.exprPurity(e) >= TreeInfo.Pure) then
6262
new PossiblyHoistedValue(e)
6363
else
64-
new PossiblyHoistedValue(tpd.SyntheticValDef(TempResultName.fresh(), e))
64+
new PossiblyHoistedValue(tpd.SyntheticValDef(TempResultName.fresh(), e).withSpan(e.span))
6565

6666
/** The left-hand side of an assignment. */
6767
private[typer] sealed abstract class LValue:

0 commit comments

Comments
 (0)