Skip to content

Commit 1183d0d

Browse files
Merge pull request #4155 from dotty-staging/kill-interpreter
Fix #3853 and #4151: Compile code in the macro definition and remove interpreter
2 parents 99f1fd3 + ec164ff commit 1183d0d

20 files changed

+399
-326
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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
235235
// be duplicated
236236
// 2. To enable correct pickling (calls can share symbols with the inlined code, which
237237
// would trigger an assertion when pickling).
238-
val callTrace = Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
238+
// In the case of macros we keep the call to be able to reconstruct the parameters that
239+
// are passed to the macro. This same simplification is applied in ReifiedQuotes when the
240+
// macro splices are evaluated.
241+
val callTrace =
242+
if (call.symbol.is(Macro)) call
243+
else Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
239244
cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion))
240245
case tree: Template =>
241246
withNoCheckNews(tree.parents.flatMap(newPart)) {

0 commit comments

Comments
 (0)