Skip to content

Handle StringContext intrinsic macro definitions compiled with Dotty #9986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,15 @@ class TreeUnpickler(reader: TastyReader,
if sym.isOpaqueAlias then sym.setFlag(Deferred)
val isScala2MacroDefinedInScala3 = flags.is(Macro, butNot = Inline) && flags.is(Erased)
ctx.owner match {
case cls: ClassSymbol if !isScala2MacroDefinedInScala3 => cls.enter(sym)
case cls: ClassSymbol if !isScala2MacroDefinedInScala3 || cls == defn.StringContextClass =>
// Enter all members of classes that are not Scala 2 macros.
//
// For `StringContext`, enter `s`, `f` and `raw`
// These definitions will be entered when defined in Scala 2. It is fine to enter them
// as they are intrinsic macros and are specially handled by the compiler.
// Dual macro definitions will not work on `StringContext` as we would enter the symbol twice.
// But dual macros will never be needed for those definitions due to their intinsic nature.
cls.enter(sym)
case _ =>
}
registerSym(start, sym)
Expand Down
Loading