File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
compiler/src/dotty/tools/dotc/transform
tests/pos-custom-args/no-experimental Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ class PruneErasedDefs extends MiniPhase with SymTransformer { thisTransform =>
5555 tree
5656
5757 def checkErasedInExperimental (sym : Symbol )(using Context ): Unit =
58- if sym.is(Erased ) && sym != defn.Compiletime_erasedValue && ! sym.isInExperimentalScope then
58+ // Make an exception for Scala 2 experimental macros to allow dual Scala 2/3 macros under non experimental mode
59+ if sym.is(Erased , butNot = Macro ) && sym != defn.Compiletime_erasedValue && ! sym.isInExperimentalScope then
5960 Feature .checkExperimentalFeature(" erased" , sym.sourcePos)
6061}
6162
Original file line number Diff line number Diff line change 1+ // src-2/MacroImpl.scala
2+ trait Context {
3+ object universe {
4+ type Literal
5+ }
6+ }
7+
8+ class MacroImpl (val c : Context ) {
9+ import c .universe .*
10+ def mono : Literal = ???
11+ }
12+
13+ // src-3/Macros.scala
14+ import scala .language .experimental .macros
15+
16+ object Macros {
17+
18+ object Bundles {
19+ def mono : Unit = macro MacroImpl .mono
20+ inline def mono : Unit = $ { Macros3 .monoImpl }
21+ }
22+
23+ object Macros3 {
24+ def monoImpl (using quoted.Quotes ) = ' {()}
25+ }
26+
27+ }
You can’t perform that action at this time.
0 commit comments