Skip to content

Commit a7d67b0

Browse files
committed
Don't pickle Scala 2 macro definitions in Scala 3
1 parent c54faa0 commit a7d67b0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TreePickler(pickler: TastyPickler) {
7575

7676
def preRegister(tree: Tree)(using Context): Unit = tree match {
7777
case tree: MemberDef =>
78-
if (!symRefs.contains(tree.symbol)) symRefs(tree.symbol) = NoAddr
78+
if (!symRefs.contains(tree.symbol) && !tree.symbol.isScala2MacroInScala3) symRefs(tree.symbol) = NoAddr
7979
case _ =>
8080
}
8181

@@ -332,6 +332,8 @@ class TreePickler(pickler: TastyPickler) {
332332

333333
def pickleDef(tag: Int, mdef: MemberDef, tpt: Tree, rhs: Tree = EmptyTree, pickleParams: => Unit = ())(using Context): Unit = {
334334
val sym = mdef.symbol
335+
if sym.isScala2MacroInScala3 then return
336+
335337
assert(symRefs(sym) == NoAddr, sym)
336338
registerDef(sym)
337339
writeByte(tag)

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ class Semantic {
795795

796796
// follow constructor
797797
if cls.hasSource then
798+
printer.println("init super class " + cls.show)
798799
val res2 = thisV.call(ctor, superType = NoType, source)(using heap, ctx, trace.add(source))
799800
errorBuffer ++= res2.errors
800801

0 commit comments

Comments
 (0)