File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,9 @@ object Feature:
3636 Properties .experimental && ! ctx.settings.YnoExperimental .value
3737
3838 def isExperimental (feature : TermName ): Boolean =
39- feature match
39+ feature != scala2macros && feature. match
4040 case QualifiedName (nme.experimental, _) => true
41- case _ => true
41+ case _ => false
4242
4343 /** Is `feature` enabled by by a command-line setting? The enabling setting is
4444 *
@@ -117,7 +117,9 @@ object Feature:
117117 /** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
118118 def checkExperimentalFlags (using Context ): Unit =
119119 if ! experimentalEnabled then
120- val features = ctx.settings.language.value.filter(_.contains(nme.experimental.toString))
120+ val features = ctx.settings.language.value.filter { feature =>
121+ feature.contains(nme.experimental.toString) && ! feature.contains(" macros" )
122+ }
121123 if features.nonEmpty then
122124 report.error(
123125 experimentalWarningMessage +
Original file line number Diff line number Diff 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"
Original file line number Diff line number Diff line change @@ -3080,7 +3080,10 @@ object Parsers {
30803080 val imp = Import (tree, selectors)
30813081 if isLanguageImport(tree) then
30823082 in.languageImportContext = in.languageImportContext.importContext(imp, NoSymbol )
3083- if isExperimentalImport(tree) && ! Feature .experimentalEnabled then
3083+ if isExperimentalImport(tree)
3084+ && ! Feature .experimentalEnabled
3085+ && selectors.exists(_.name != nme.macros)
3086+ then
30843087 report.error(Feature .experimentalWarningMessage, imp.srcPos)
30853088 for
30863089 case ImportSelector (id @ Ident (imported), EmptyTree , _) <- selectors
You can’t perform that action at this time.
0 commit comments