Skip to content

Commit e25c61d

Browse files
committed
Macros are not experimental
1 parent 06106a7 commit e25c61d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

compiler/src/dotty/tools/dotc/config/Feature.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ object Feature:
3535
Properties.experimental && !ctx.settings.YnoExperimental.value
3636

3737
def isExperimental(feature: TermName): Boolean =
38-
feature match
38+
feature != scala2macros && feature.match
3939
case QualifiedName(nme.experimental, _) => true
40-
case _ => true
40+
case _ => false
4141

4242
/** Is `feature` enabled by by a command-line setting? The enabling setting is
4343
*
@@ -116,7 +116,9 @@ object Feature:
116116
/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
117117
def checkExperimentalFlags(using Context): Unit =
118118
if !experimentalEnabled then
119-
val features = ctx.settings.language.value.filter(_.contains(nme.experimental.toString))
119+
val features = ctx.settings.language.value.filter { feature =>
120+
feature.contains(nme.experimental.toString) && !feature.contains("macros")
121+
}
120122
if features.nonEmpty then
121123
report.error(
122124
experimentalWarningMessage +

compiler/src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ object StdNames {
520520
val longHash: N = "longHash"
521521
val macroThis : N = "_this"
522522
val macroContext : N = "c"
523+
val macros: N = "macros"
523524
val main: N = "main"
524525
val manifest: N = "manifest"
525526
val ManifestFactory: N = "ManifestFactory"

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,10 @@ object Parsers {
30363036
val imp = Import(tree, selectors)
30373037
if isLanguageImport(tree) then
30383038
in.languageImportContext = in.languageImportContext.importContext(imp, NoSymbol)
3039-
if isExperimentalImport(tree) && !Feature.experimentalEnabled then
3039+
if isExperimentalImport(tree)
3040+
&& !Feature.experimentalEnabled
3041+
&& selectors.exists(_.name != nme.macros)
3042+
then
30403043
report.error(Feature.experimentalWarningMessage, imp.srcPos)
30413044
for
30423045
case ImportSelector(id @ Ident(imported), EmptyTree, _) <- selectors

0 commit comments

Comments
 (0)