Skip to content

Commit fdf3e48

Browse files
committed
Address review comments
1 parent 4924c9c commit fdf3e48

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

Diff for: compiler/src/dotty/tools/dotc/typer/Checking.scala

+14-15
Original file line numberDiff line numberDiff line change
@@ -804,23 +804,22 @@ object Checking {
804804
*
805805
*/
806806
def checkAndAdaptExperimentalImports(trees: List[Tree])(using Context): Unit =
807-
def nonExperimentalTopLevelDefs(): Iterator[Symbol] =
807+
def nonExperimentalTopLevelDefs(): List[Symbol] =
808808
new TreeAccumulator[List[Symbol]] {
809809
override def apply(x: List[Symbol], tree: tpd.Tree)(using Context): List[Symbol] =
810-
def addIfExperimental(sym: Symbol) =
811-
if !sym.isExperimental then sym :: x
812-
else x
813-
tree match {
814-
case tpd.PackageDef(_, contents) =>
815-
super.apply(x, contents)
816-
case defdef: tpd.DefDef => addIfExperimental(defdef.symbol)
817-
case valdef: tpd.ValDef => addIfExperimental(valdef.symbol)
818-
case typeDef @ tpd.TypeDef(_, temp: Template) if typeDef.symbol.isPackageObject =>
819-
super.apply(x, temp.body)
820-
case typeDef @ tpd.TypeDef(_, Template(_, _, _, _)) => addIfExperimental(typeDef.symbol)
821-
case _ => x
822-
}
823-
}.apply(Nil, ctx.compilationUnit.tpdTree).iterator
810+
def addIfNotExperimental(sym: Symbol) =
811+
println(sym)
812+
if !sym.isExperimental then sym :: x
813+
else x
814+
tree match {
815+
case tpd.PackageDef(_, contents) => apply(x, contents)
816+
case typeDef @ tpd.TypeDef(_, temp: Template) if typeDef.symbol.isPackageObject =>
817+
apply(x, temp.body)
818+
case mdef: tpd.ValDef if mdef.symbol.isPackageObject => x // ValDef(new PackageObject)
819+
case mdef: tpd.MemberDef => addIfNotExperimental(mdef.symbol)
820+
case _ => x
821+
}
822+
}.apply(Nil, ctx.compilationUnit.tpdTree)
824823

825824
def unitExperimentalLanguageImports =
826825
def isAllowedImport(sel: untpd.ImportSelector) =

0 commit comments

Comments
 (0)