File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
compiler/src/scala/quoted/runtime/impl Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ class QuoteMatcher(debug: Boolean) {
135135 // After matching and doing all subtype checks, we have to approximate all the type bindings
136136 // that we have found, seal them in a quoted.Type and add them to the result
137137 val typeHoleApproximations = typeHoles.map(typeHoleApproximation)
138- val matchedTypes = typeHoleApproximations.map(tpe => new TypeImpl (TypeTree (tpe), spliceScope))
138+ val matchedTypes = typeHoleApproximations.map { tpe =>
139+ new TypeImpl (TypeTree (tpe).withSpan(scrutinee.span), spliceScope)
140+ }
139141 val matchedExprs =
140142 val typeHoleMap : Type => Type =
141143 if typeHoles.isEmpty then identity
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+ object Macro :
4+ transparent inline def foo : Any = $ { fooImpl }
5+
6+ def fooImpl (using Quotes ): Expr [Any ] =
7+ import quotes .reflect .*
8+ ' {
9+ val xxx = $ {
10+ Type .of[Int ] match
11+ case ' [tpe] =>
12+ Typed (Expr (1 ).asTerm, TypeTree .of[tpe]).asExpr
13+ }
14+ xxx
15+ }
Original file line number Diff line number Diff line change 1+ @ main def run () =
2+ println(Macro .foo)
You can’t perform that action at this time.
0 commit comments