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:
36
36
Properties .experimental && ! ctx.settings.YnoExperimental .value
37
37
38
38
def isExperimental (feature : TermName ): Boolean =
39
- feature match
39
+ feature != scala2macros && feature. match
40
40
case QualifiedName (nme.experimental, _) => true
41
- case _ => true
41
+ case _ => false
42
42
43
43
/** Is `feature` enabled by by a command-line setting? The enabling setting is
44
44
*
@@ -117,7 +117,9 @@ object Feature:
117
117
/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
118
118
def checkExperimentalFlags (using Context ): Unit =
119
119
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
+ }
121
123
if features.nonEmpty then
122
124
report.error(
123
125
experimentalWarningMessage +
Original file line number Diff line number Diff line change @@ -520,6 +520,7 @@ object StdNames {
520
520
val longHash : N = " longHash"
521
521
val macroThis : N = " _this"
522
522
val macroContext : N = " c"
523
+ val macros : N = " macros"
523
524
val main : N = " main"
524
525
val manifest : N = " manifest"
525
526
val ManifestFactory : N = " ManifestFactory"
Original file line number Diff line number Diff line change @@ -3080,7 +3080,10 @@ object Parsers {
3080
3080
val imp = Import (tree, selectors)
3081
3081
if isLanguageImport(tree) then
3082
3082
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
3084
3087
report.error(Feature .experimentalWarningMessage, imp.srcPos)
3085
3088
for
3086
3089
case ImportSelector (id @ Ident (imported), EmptyTree , _) <- selectors
You can’t perform that action at this time.
0 commit comments