Skip to content

Commit 5176fb9

Browse files
committed
Fix #7358: Add missing span to spliced tree
1 parent e005473 commit 5176fb9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class ReifyQuotes extends MacroTransform {
134134
private def addTags(expr: Tree)(implicit ctx: Context): Tree = {
135135

136136
def mkTagSymbolAndAssignType(spliced: TermRef): TypeDef = {
137-
val splicedTree = tpd.ref(spliced)
137+
val splicedTree = tpd.ref(spliced).withSpan(expr.span)
138138
val rhs = transform(splicedTree.select(tpnme.splice))
139139
val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs)
140140
val local = ctx.newSymbol(

tests/pos/i7358.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package test
2+
3+
import scala.quoted._
4+
import scala.compiletime._
5+
6+
inline def summonT[Tp <: Tuple] <: Tuple = inline erasedValue[Tp] match {
7+
case _ : Unit => ()
8+
case _ : (hd *: tl) => {
9+
type H = hd
10+
summonFrom {
11+
case given _ : Type[H] => summon[Type[H]] *: summonT[tl]
12+
}
13+
}
14+
}
15+
16+
def test[T : Type] = summonT[Tuple1[List[T]]]

0 commit comments

Comments
 (0)