Skip to content

Commit

Permalink
Fix Feature reference after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Aug 31, 2021
1 parent 37f1d7b commit 1d9e672
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -746,20 +746,23 @@ 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
nonExperimentalStat(trees) match
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
}
Expand Down

0 comments on commit 1d9e672

Please sign in to comment.