Skip to content

Commit 352dd99

Browse files
committed
Fix #3853: Compile code in the macro definition and remove interpreter
The only interpreted code remaining is a call to a static method containing a lambda which can compute the resulting inlined quoted expression. Arguments to the macro are trivially computed from the inlined call and bindings.
1 parent ded6027 commit 352dd99

19 files changed

+349
-317
lines changed

compiler/src/dotty/tools/dotc/interpreter/Interpreter.scala

Lines changed: 0 additions & 222 deletions
This file was deleted.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
231231
// be duplicated
232232
// 2. To enable correct pickling (calls can share symbols with the inlined code, which
233233
// would trigger an assertion when pickling).
234-
val callTrace = Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
234+
val callTrace =
235+
if (call.symbol.is(Macro)) call
236+
else Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
235237
cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion))
236238
case tree: Template =>
237239
withNoCheckNews(tree.parents.flatMap(newPart)) {

0 commit comments

Comments
 (0)