Skip to content

Commit

Permalink
Avoid some intermediate Lists (#18572)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki authored Sep 20, 2023
2 parents 2486191 + 240e95a commit b1fc943
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/MainGenericRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ object MainGenericRunner {
case (o @ javaOption(striped)) :: tail =>
processArgs(tail, settings.withJavaArgs(striped).withScalaArgs(o))
case (o @ scalaOption(_*)) :: tail =>
val remainingArgs = (CommandLineParser.expandArg(o) ++ tail).toList
val remainingArgs = CommandLineParser.expandArg(o) ++ tail
processArgs(remainingArgs, settings)
case (o @ colorOption(_*)) :: tail =>
processArgs(tail, settings.withScalaArgs(o))
Expand Down
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2131,8 +2131,11 @@ class Definitions {
this.initCtx = ctx
if (!isInitialized) {
// force initialization of every symbol that is synthesized or hijacked by the compiler
val forced =
syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses() :+ JavaEnumClass
syntheticCoreClasses
syntheticCoreMethods
ScalaValueClasses()
JavaEnumClass
// end force initialization
isInitialized = true
}
addSyntheticSymbolsComments
Expand Down
18 changes: 13 additions & 5 deletions compiler/src/dotty/tools/dotc/transform/CheckUnused.scala
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,19 @@ object CheckUnused:
else
Nil
val warnings =
List(sortedImp, sortedLocalDefs, sortedExplicitParams, sortedImplicitParams,
sortedPrivateDefs, sortedPatVars, unsetLocalDefs, unsetPrivateDefs).flatten.sortBy { s =>
val pos = s.pos.sourcePos
(pos.line, pos.column)
}
val unsorted =
sortedImp :::
sortedLocalDefs :::
sortedExplicitParams :::
sortedImplicitParams :::
sortedPrivateDefs :::
sortedPatVars :::
unsetLocalDefs :::
unsetPrivateDefs
unsorted.sortBy { s =>
val pos = s.pos.sourcePos
(pos.line, pos.column)
}
UnusedResult(warnings.toSet)
end getUnused
//============================ HELPERS ====================================
Expand Down

0 comments on commit b1fc943

Please sign in to comment.