@@ -746,20 +746,23 @@ object Checking {
746
746
EmptyTree
747
747
748
748
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
+
749
753
languageImport(qual) match
750
754
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) =>
753
756
def check (stable : => String ) =
754
- checkExperimentalFeature(" features" , imp.srcPos,
757
+ Feature . checkExperimentalFeature(" features" , imp.srcPos,
755
758
s " \n\n Note: the scope enclosing the import is not considered experimental because it contains the \n non-experimental $stable" )
756
759
if ctx.owner.is(Package ) then
757
760
// allow top-level experimental imports if all definitions are @experimental
758
761
nonExperimentalStat(trees) match
759
762
case EmptyTree =>
760
763
case tree : MemberDef => check(i " ${tree.symbol}" )
761
764
case tree => check(i " expression ${tree}" )
762
- else checkExperimentalFeature(" features" , imp.srcPos)
765
+ else Feature . checkExperimentalFeature(" features" , imp.srcPos)
763
766
case _ =>
764
767
end checkExperimentalImports
765
768
}
0 commit comments