Skip to content

Fix #7358: Add missing span to spliced tree #7361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ReifyQuotes extends MacroTransform {
private def addTags(expr: Tree)(implicit ctx: Context): Tree = {

def mkTagSymbolAndAssignType(spliced: TermRef): TypeDef = {
val splicedTree = tpd.ref(spliced)
val splicedTree = tpd.ref(spliced).withSpan(expr.span)
val rhs = transform(splicedTree.select(tpnme.splice))
val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs)
val local = ctx.newSymbol(
Expand Down
16 changes: 16 additions & 0 deletions tests/pos/i7358.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package test

import scala.quoted._
import scala.compiletime._

inline def summonT[Tp <: Tuple] <: Tuple = inline erasedValue[Tp] match {
case _ : Unit => ()
case _ : (hd *: tl) => {
type H = hd
summonFrom {
case given _ : Type[H] => summon[Type[H]] *: summonT[tl]
}
}
}

def test[T : Type] = summonT[Tuple1[List[T]]]