Skip to content

Commit c16fd52

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

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ object Feature:
2626
val dependent = experimental("dependent")
2727
val erasedDefinitions = experimental("erasedDefinitions")
2828
val symbolLiterals: TermName = deprecated("symbolLiterals")
29+
val macros = experimental("macros")
2930

3031
val experimentalWarningMessage = "Experimental features may only be used with nightly or snapshot version of compiler."
3132

@@ -35,9 +36,9 @@ object Feature:
3536
Properties.experimental && !ctx.settings.YnoExperimental.value
3637

3738
def isExperimental(feature: TermName): Boolean =
38-
feature match
39+
feature != macros && feature.match
3940
case QualifiedName(nme.experimental, _) => true
40-
case _ => true
41+
case _ => false
4142

4243
/** Is `feature` enabled by by a command-line setting? The enabling setting is
4344
*

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)