You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#4801: Allow top-level splices not directly in the RHS
For example a transparent method can be defined as
```
transparent def foo(b: Boolean): Int =
if (b) ~bar(true)
else ~bar(false)
```
Removing this restriction also allows us to have a simpler implementation
of splicing and transparent def checking.
if (ctx.reporter.hasErrors) splice else transform(evaluatedSplice)
427
+
}
428
+
elseif (!ctx.owner.ownersIterator.exists(_.is(Transparent))) { // level 0 outside a transparent definition
429
+
ctx.error(i"splice outside quotes or transparent method", splice.pos)
430
+
splice
431
+
}
432
+
elseif (Splicer.canBeSpliced(splice.qualifier)) { // level 0 inside a transparent definition
433
+
nested(isQuote =false).split(splice.qualifier) // Just check PCP
434
+
splice
435
+
}
436
+
else { // level 0 inside a transparent definition
437
+
ctx.error("Malformed macro call. The contents of the ~ must call a static method and arguments must be quoted or transparent.".stripMargin, splice.pos)
438
+
splice
439
+
}
429
440
}
430
441
431
442
/** Transforms the contents of a nested splice
@@ -550,39 +561,10 @@ class ReifyQuotes extends MacroTransformWithImplicits {
0 commit comments