Skip to content

Commit 1fe6567

Browse files
Merge pull request #3335 from dotty-staging/remove-scope-filter-toList
Remove Scope.filter(...).toList
2 parents dd1882b + ece9915 commit 1fe6567

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
707707
private def definedClasses(phase: Phase) =
708708
if (sym.isDefinedInCurrentRun)
709709
ctx.atPhase(phase) { implicit ctx =>
710-
toDenot(sym).info.decls.filter(_.isClass).toList
710+
toDenot(sym).info.decls.filter(_.isClass)
711711
}
712712
else Nil
713713

@@ -719,7 +719,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
719719
else Nil
720720
}
721721
def fieldSymbols: List[Symbol] = {
722-
toDenot(sym).info.decls.filter(p => p.isTerm && !p.is(Flags.Method)).toList
722+
toDenot(sym).info.decls.filter(p => p.isTerm && !p.is(Flags.Method))
723723
}
724724
def methodSymbols: List[Symbol] =
725725
for (f <- toDenot(sym).info.decls.toList if f.isMethod && f.isTerm && !f.isModule) yield f

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ object SymDenotations {
17531753
* Both getters and setters are returned in this list.
17541754
*/
17551755
def paramAccessors(implicit ctx: Context): List[Symbol] =
1756-
unforcedDecls.filter(_.is(ParamAccessor)).toList
1756+
unforcedDecls.filter(_.is(ParamAccessor))
17571757

17581758
/** If this class has the same `decls` scope reference in `phase` and
17591759
* `phase.next`, install a new denotation with a cloned scope in `phase.next`.

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
215215
// and can therefore be ignored.
216216
def alwaysPresent(s: Symbol) =
217217
s.isCompanionMethod || (csym.is(ModuleClass) && s.isConstructor)
218-
val decls = cinfo.decls.filter(!alwaysPresent(_)).toList
218+
val decls = cinfo.decls.filter(!alwaysPresent(_))
219219
val apiDecls = apiDefinitions(decls)
220220

221221
val declSet = decls.toSet

compiler/src/dotty/tools/dotc/transform/Mixin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
240240
}
241241

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

246246
cpy.Template(impl)(

compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ResolveSuper extends MiniPhaseTransform with IdentityDenotTransformer { th
6161
import ops._
6262

6363
def superAccessors(mixin: ClassSymbol): List[Tree] =
64-
for (superAcc <- mixin.info.decls.filter(_.isSuperAccessor).toList)
64+
for (superAcc <- mixin.info.decls.filter(_.isSuperAccessor))
6565
yield {
6666
util.Stats.record("super accessors")
6767
polyDefDef(implementation(superAcc.asTerm), forwarder(rebindSuper(cls, superAcc)))

compiler/src/dotty/tools/dotc/transform/SymUtils.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ class SymUtils(val self: Symbol) extends AnyVal {
8989
self.owner.info.decl(name).suchThat(_ is Accessor).symbol
9090

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

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

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

0 commit comments

Comments
 (0)