File tree 3 files changed +10
-4
lines changed
compiler/src/dotty/tools/dotc 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,9 @@ object Feature:
35
35
Properties .experimental && ! ctx.settings.YnoExperimental .value
36
36
37
37
def isExperimental (feature : TermName ): Boolean =
38
- feature match
38
+ feature != scala2macros && feature. match
39
39
case QualifiedName (nme.experimental, _) => true
40
- case _ => true
40
+ case _ => false
41
41
42
42
/** Is `feature` enabled by by a command-line setting? The enabling setting is
43
43
*
@@ -116,7 +116,9 @@ object Feature:
116
116
/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
117
117
def checkExperimentalFlags (using Context ): Unit =
118
118
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
+ }
120
122
if features.nonEmpty then
121
123
report.error(
122
124
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 @@ -3036,7 +3036,10 @@ object Parsers {
3036
3036
val imp = Import (tree, selectors)
3037
3037
if isLanguageImport(tree) then
3038
3038
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
3040
3043
report.error(Feature .experimentalWarningMessage, imp.srcPos)
3041
3044
for
3042
3045
case ImportSelector (id @ Ident (imported), EmptyTree , _) <- selectors
You can’t perform that action at this time.
0 commit comments