Skip to content

Commit e4020b9

Browse files
Backport "Avoid some intermediate Lists" to LTS (#20655)
Backports #18572 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents bd5f433 + e91fddf commit e4020b9

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

compiler/src/dotty/tools/MainGenericRunner.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ object MainGenericRunner {
148148
case (o @ javaOption(striped)) :: tail =>
149149
processArgs(tail, settings.withJavaArgs(striped).withScalaArgs(o))
150150
case (o @ scalaOption(_*)) :: tail =>
151-
val remainingArgs = (CommandLineParser.expandArg(o) ++ tail).toList
151+
val remainingArgs = CommandLineParser.expandArg(o) ++ tail
152152
processArgs(remainingArgs, settings)
153153
case (o @ colorOption(_*)) :: tail =>
154154
processArgs(tail, settings.withScalaArgs(o))

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,11 @@ class Definitions {
21192119
this.initCtx = ctx
21202120
if (!isInitialized) {
21212121
// force initialization of every symbol that is synthesized or hijacked by the compiler
2122-
val forced =
2123-
syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses() :+ JavaEnumClass
2122+
syntheticCoreClasses
2123+
syntheticCoreMethods
2124+
ScalaValueClasses()
2125+
JavaEnumClass
2126+
// end force initialization
21242127
isInitialized = true
21252128
}
21262129
addSyntheticSymbolsComments

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

+13-5
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,19 @@ object CheckUnused:
561561
else
562562
Nil
563563
val warnings =
564-
List(sortedImp, sortedLocalDefs, sortedExplicitParams, sortedImplicitParams,
565-
sortedPrivateDefs, sortedPatVars, unsetLocalDefs, unsetPrivateDefs).flatten.sortBy { s =>
566-
val pos = s.pos.sourcePos
567-
(pos.line, pos.column)
568-
}
564+
val unsorted =
565+
sortedImp :::
566+
sortedLocalDefs :::
567+
sortedExplicitParams :::
568+
sortedImplicitParams :::
569+
sortedPrivateDefs :::
570+
sortedPatVars :::
571+
unsetLocalDefs :::
572+
unsetPrivateDefs
573+
unsorted.sortBy { s =>
574+
val pos = s.pos.sourcePos
575+
(pos.line, pos.column)
576+
}
569577
UnusedResult(warnings.toSet)
570578
end getUnused
571579
//============================ HELPERS ====================================

0 commit comments

Comments
 (0)