Skip to content

Remove Scope.filter(...).toList #3335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
private def definedClasses(phase: Phase) =
if (sym.isDefinedInCurrentRun)
ctx.atPhase(phase) { implicit ctx =>
toDenot(sym).info.decls.filter(_.isClass).toList
toDenot(sym).info.decls.filter(_.isClass)
}
else Nil

Expand All @@ -719,7 +719,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
else Nil
}
def fieldSymbols: List[Symbol] = {
toDenot(sym).info.decls.filter(p => p.isTerm && !p.is(Flags.Method)).toList
toDenot(sym).info.decls.filter(p => p.isTerm && !p.is(Flags.Method))
}
def methodSymbols: List[Symbol] =
for (f <- toDenot(sym).info.decls.toList if f.isMethod && f.isTerm && !f.isModule) yield f
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ object SymDenotations {
* Both getters and setters are returned in this list.
*/
def paramAccessors(implicit ctx: Context): List[Symbol] =
unforcedDecls.filter(_.is(ParamAccessor)).toList
unforcedDecls.filter(_.is(ParamAccessor))

/** If this class has the same `decls` scope reference in `phase` and
* `phase.next`, install a new denotation with a cloned scope in `phase.next`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
// and can therefore be ignored.
def alwaysPresent(s: Symbol) =
s.isCompanionMethod || (csym.is(ModuleClass) && s.isConstructor)
val decls = cinfo.decls.filter(!alwaysPresent(_)).toList
val decls = cinfo.decls.filter(!alwaysPresent(_))
val apiDecls = apiDefinitions(decls)

val declSet = decls.toSet
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Mixin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
}

def setters(mixin: ClassSymbol): List[Tree] =
for (setter <- mixin.info.decls.filter(setr => setr.isSetter && !was(setr, Deferred)).toList)
for (setter <- mixin.info.decls.filter(setr => setr.isSetter && !was(setr, Deferred)))
yield transformFollowing(DefDef(implementation(setter.asTerm), unitLiteral.withPos(cls.pos)))

cpy.Template(impl)(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ResolveSuper extends MiniPhaseTransform with IdentityDenotTransformer { th
import ops._

def superAccessors(mixin: ClassSymbol): List[Tree] =
for (superAcc <- mixin.info.decls.filter(_.isSuperAccessor).toList)
for (superAcc <- mixin.info.decls.filter(_.isSuperAccessor))
yield {
util.Stats.record("super accessors")
polyDefDef(implementation(superAcc.asTerm), forwarder(rebindSuper(cls, superAcc)))
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/transform/SymUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class SymUtils(val self: Symbol) extends AnyVal {
self.owner.info.decl(name).suchThat(_ is Accessor).symbol

def paramAccessors(implicit ctx: Context): List[Symbol] =
self.info.decls.filter(_ is ParamAccessor).toList
self.info.decls.filter(_ is ParamAccessor)

def caseAccessors(implicit ctx:Context) =
self.info.decls.filter(_ is CaseAccessor).toList
def caseAccessors(implicit ctx: Context): List[Symbol] =
self.info.decls.filter(_ is CaseAccessor)

def getter(implicit ctx: Context): Symbol =
if (self.isGetter) self else accessorNamed(self.asTerm.name.getterName)
Expand Down