Skip to content

Commit b1d3293

Browse files
committed
Enter StringContext s, f and raw Scala 2 macros
1 parent 2f5b5fd commit b1d3293

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,15 @@ class TreeUnpickler(reader: TastyReader,
584584
if sym.isOpaqueAlias then sym.setFlag(Deferred)
585585
val isScala2MacroDefinedInScala3 = flags.is(Macro, butNot = Inline) && flags.is(Erased)
586586
ctx.owner match {
587-
case cls: ClassSymbol if !isScala2MacroDefinedInScala3 => cls.enter(sym)
587+
case cls: ClassSymbol if !isScala2MacroDefinedInScala3 || cls == defn.StringContextClass =>
588+
// Enter all members of classes that are not Scala 2 macros.
589+
//
590+
// For `StringContext`, enter `s`, `f` and `raw`
591+
// These definitions will be entered when defined in Scala 2. It is fine to enter them
592+
// as they are intrinsic macros and are specially handled by the compiler.
593+
// Dual macro definitions will not work on `StringContext` as we would enter the symbol twice.
594+
// But dual macros will never be needed for those definitions due to their intinsic nature.
595+
cls.enter(sym)
588596
case _ =>
589597
}
590598
registerSym(start, sym)

0 commit comments

Comments
 (0)