@@ -83,7 +83,7 @@ class Staging extends MacroTransformWithImplicits {
83
83
* These will be turned into splices using `addTags` and represent types spliced
84
84
* explicitly.
85
85
*/
86
- val explicitTags = new mutable.LinkedHashSet [TypeRef ]()
86
+ val explicitTags = new mutable.LinkedHashSet [( TypeRef , Position ) ]()
87
87
88
88
/** A stack of entered symbols, to be unwound after scope exit */
89
89
var enteredSyms : List [Symbol ] = Nil
@@ -111,7 +111,8 @@ class Staging extends MacroTransformWithImplicits {
111
111
name = UniqueName .fresh(" T" .toTermName).toTypeName,
112
112
flags = Synthetic ,
113
113
info = TypeAlias (tag.tpe.select(tpnme.UNARY_~ )),
114
- coord = typeRef.prefix.termSymbol.coord).asType
114
+ coord = alias.pos
115
+ ).asType
115
116
116
117
ctx.typeAssigner.assignType(untpd.TypeDef (local.name, alias), local)
117
118
}
@@ -126,11 +127,11 @@ class Staging extends MacroTransformWithImplicits {
126
127
importedTags.clear()
127
128
128
129
// The tree of the tag for each tag comes from a type ref e.g., ~t
129
- val explicitTypeDefs = for (tref <- explicitTags) yield {
130
- val tag = ref(tref.prefix.termSymbol)
130
+ val explicitTypeDefs = for (( tref, pos) <- explicitTags) yield {
131
+ val tag = ref(tref.prefix.termSymbol).withPos(pos)
131
132
mkTagSymbolAndAssignType(tref, tag)
132
133
}
133
- val tagsExplicitTypeDefsPairs = explicitTags.zip(explicitTypeDefs)
134
+ val tagsExplicitTypeDefsPairs = explicitTags.map(_._1). zip(explicitTypeDefs)
134
135
explicitTags.clear()
135
136
136
137
// Maps type splices to type references of tags e.g., ~t -> some type T$1
@@ -243,7 +244,7 @@ class Staging extends MacroTransformWithImplicits {
243
244
tp match {
244
245
case tp : TypeRef if tp.symbol.isSplice =>
245
246
if (inQuote) {
246
- explicitTags += tp
247
+ explicitTags += Tuple2 (tp, pos)
247
248
outer.checkType(pos).foldOver(acc, tp)
248
249
}
249
250
else {
@@ -396,7 +397,8 @@ class Staging extends MacroTransformWithImplicits {
396
397
tree.rhs match {
397
398
case InlineSplice (_) =>
398
399
mapOverTree(enteredSyms) // Ignore output, only check PCP
399
- cpy.DefDef (tree)(rhs = defaultValue(tree.rhs.tpe))
400
+ // cpy.DefDef(tree)(rhs = defaultValue(tree.rhs.tpe))
401
+ tree
400
402
case _ =>
401
403
ctx.error(
402
404
""" Malformed macro.
0 commit comments