Skip to content

Commit bf911e5

Browse files
authored
[stdlib] be more conservative in what we copy from Scala 2 (#24339)
Because some of the classes we copy from stdlib contains private members and local classes, we will now copy everything (including local classes and companion classes) to the new stdlib artefact. This is a conservative approach and we don't want to go over each file we copy and check them manually.
2 parents d463d6d + 454c24a commit bf911e5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

project/ScalaLibraryPlugin.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ object ScalaLibraryPlugin extends AutoPlugin {
5151
(files, reference) <- patches
5252
file <- files
5353
id <- file.relativeTo(reference)
54-
if filesToCopy(id.toString().replace("\\", "/")) // Only Override Some Very Specific Files
54+
path = id.toString().replace("\\", "/").stripSuffix(".class").stripSuffix(".sjsir")
55+
if filesToCopy.exists(s => path == s || path.startsWith(s + '$')) // Only Override Some Very Specific Files
5556
dest = target / (id.toString)
5657
ref <- dest.relativeTo((LocalRootProject / baseDirectory).value)
5758
} {
@@ -111,7 +112,7 @@ object ScalaLibraryPlugin extends AutoPlugin {
111112
"scala/collection/immutable/DoubleVectorStepper",
112113
"scala/collection/immutable/IntVectorStepper",
113114
"scala/collection/immutable/LongVectorStepper",
114-
"scala/collection/immutable/Range", "scala/collection/immutable/Range$",
115+
"scala/collection/immutable/Range",
115116
"scala/jdk/DoubleAccumulator",
116117
"scala/jdk/IntAccumulator",
117118
"scala/jdk/LongAccumulator",
@@ -139,7 +140,7 @@ object ScalaLibraryPlugin extends AutoPlugin {
139140
"scala/jdk/FunctionWrappers$FromJavaLongUnaryOperator",
140141
"scala/collection/ArrayOps$ReverseIterator",
141142
"scala/runtime/NonLocalReturnControl",
142-
"scala/util/Sorting", "scala/util/Sorting$",
143-
).flatMap(f => Seq(s"$f.class", s"$f.sjsir"))
143+
"scala/util/Sorting",
144+
)
144145

145146
}

0 commit comments

Comments
 (0)