From 1d9e6724327ebccbad51db3e087e3fec36f3de9e Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 31 Aug 2021 09:50:20 +0200 Subject: [PATCH] Fix Feature reference after rebase --- compiler/src/dotty/tools/dotc/typer/Checking.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 10f8acc4e453..3b743906fd51 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -746,12 +746,15 @@ object Checking { EmptyTree for case imp @ Import(qual, selectors) <- trees do + def isAllowedImport(sel: untpd.ImportSelector) = + val name = Feature.experimental(sel.name) + name == Feature.scala2macros || name == Feature.erasedDefinitions + languageImport(qual) match case Some(nme.experimental) - if !ctx.owner.isInExperimentalScope - && selectors.exists(sel => experimental(sel.name) != scala2macros && experimental(sel.name) != erasedDefinitions) => + if !ctx.owner.isInExperimentalScope && !selectors.forall(isAllowedImport) => def check(stable: => String) = - checkExperimentalFeature("features", imp.srcPos, + Feature.checkExperimentalFeature("features", imp.srcPos, s"\n\nNote: the scope enclosing the import is not considered experimental because it contains the\nnon-experimental $stable") if ctx.owner.is(Package) then // allow top-level experimental imports if all definitions are @experimental @@ -759,7 +762,7 @@ object Checking { case EmptyTree => case tree: MemberDef => check(i"${tree.symbol}") case tree => check(i"expression ${tree}") - else checkExperimentalFeature("features", imp.srcPos) + else Feature.checkExperimentalFeature("features", imp.srcPos) case _ => end checkExperimentalImports }