Skip to content

Commit cf1a732

Browse files
committed
Fix Feature reference after rebase
1 parent 37f1d7b commit cf1a732

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,20 +746,23 @@ object Checking {
746746
EmptyTree
747747

748748
for case imp @ Import(qual, selectors) <- trees do
749+
def isAllowedImport(sel: untpd.ImportSelector) =
750+
val name = Feature.experimental(sel.name)
751+
name == Feature.scala2macros || name == Feature.erasedDefinitions
752+
749753
languageImport(qual) match
750754
case Some(nme.experimental)
751-
if !ctx.owner.isInExperimentalScope
752-
&& selectors.exists(sel => experimental(sel.name) != scala2macros && experimental(sel.name) != erasedDefinitions) =>
755+
if !ctx.owner.isInExperimentalScope1 && !selectors.forall(isAllowedImport) =>
753756
def check(stable: => String) =
754-
checkExperimentalFeature("features", imp.srcPos,
757+
Feature.checkExperimentalFeature("features", imp.srcPos,
755758
s"\n\nNote: the scope enclosing the import is not considered experimental because it contains the\nnon-experimental $stable")
756759
if ctx.owner.is(Package) then
757760
// allow top-level experimental imports if all definitions are @experimental
758761
nonExperimentalStat(trees) match
759762
case EmptyTree =>
760763
case tree: MemberDef => check(i"${tree.symbol}")
761764
case tree => check(i"expression ${tree}")
762-
else checkExperimentalFeature("features", imp.srcPos)
765+
else Feature.checkExperimentalFeature("features", imp.srcPos)
763766
case _ =>
764767
end checkExperimentalImports
765768
}

0 commit comments

Comments
 (0)