Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jchyb committed Oct 28, 2024
1 parent 4924c9c commit 8b8bb33
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -804,23 +804,22 @@ object Checking {
*
*/
def checkAndAdaptExperimentalImports(trees: List[Tree])(using Context): Unit =
def nonExperimentalTopLevelDefs(): Iterator[Symbol] =
def nonExperimentalTopLevelDefs(): List[Symbol] =
new TreeAccumulator[List[Symbol]] {
override def apply(x: List[Symbol], tree: tpd.Tree)(using Context): List[Symbol] =
def addIfExperimental(sym: Symbol) =
if !sym.isExperimental then sym :: x
else x
tree match {
case tpd.PackageDef(_, contents) =>
super.apply(x, contents)
case defdef: tpd.DefDef => addIfExperimental(defdef.symbol)
case valdef: tpd.ValDef => addIfExperimental(valdef.symbol)
case typeDef @ tpd.TypeDef(_, temp: Template) if typeDef.symbol.isPackageObject =>
super.apply(x, temp.body)
case typeDef @ tpd.TypeDef(_, Template(_, _, _, _)) => addIfExperimental(typeDef.symbol)
case _ => x
}
}.apply(Nil, ctx.compilationUnit.tpdTree).iterator
def addIfNotExperimental(sym: Symbol) =
println(sym)
if !sym.isExperimental then sym :: x
else x
tree match {
case tpd.PackageDef(_, contents) => apply(x, contents)
case typeDef @ tpd.TypeDef(_, temp: Template) if typeDef.symbol.isPackageObject =>
apply(x, temp.body)
case mdef: tpd.ValDef if mdef.symbol.isPackageObject => x // ValDef(new PackageObject)
case mdef: tpd.MemberDef => addIfNotExperimental(mdef.symbol)
case _ => x
}
}.apply(Nil, ctx.compilationUnit.tpdTree)

def unitExperimentalLanguageImports =
def isAllowedImport(sel: untpd.ImportSelector) =
Expand Down

0 comments on commit 8b8bb33

Please sign in to comment.