File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
main/scala/scala/build/options
test/scala/scala/build/tests Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -284,15 +284,17 @@ final case class BuildOptions(
284
284
sv match {
285
285
case Some (sv0) =>
286
286
val prefix = if (sv0.endsWith(" ." )) sv0 else sv0 + " ."
287
- val matchingVersions = allVersions.filter(_.startsWith(prefix))
287
+ val matchingVersions = allVersions.filter(_.startsWith(prefix)).map( Version (_))
288
288
if (matchingVersions.isEmpty)
289
289
Left (new InvalidBinaryScalaVersionError (sv0))
290
290
else {
291
291
val validMaxVersions = maxSupportedScalaVersions
292
292
.filter(_.repr.startsWith(prefix))
293
- val validMatchingVersions = matchingVersions
294
- .map(Version (_))
295
- .filter(v => validMaxVersions.exists(v <= _))
293
+ val validMatchingVersions = {
294
+ val filtered = matchingVersions.filter(v => validMaxVersions.exists(v <= _))
295
+ if (filtered.isEmpty) matchingVersions
296
+ else filtered
297
+ }
296
298
if (validMatchingVersions.isEmpty)
297
299
Left (new UnsupportedScalaVersionError (sv0))
298
300
else
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ class BuildOptionsTests extends munit.FunSuite {
35
35
Some (" 2.12" ) -> defaultScala212Version,
36
36
Some (" 2" ) -> defaultScala213Version,
37
37
Some (" 2.13.2" ) -> " 2.13.2" ,
38
- Some (" 3.0.1" ) -> " 3.0.1"
38
+ Some (" 3.0.1" ) -> " 3.0.1" ,
39
+ Some (" 3.0" ) -> " 3.0.2"
39
40
)
40
41
41
42
for ((prefix, expectedScalaVersion) <- expectedScalaVersions)
@@ -61,6 +62,7 @@ class BuildOptionsTests extends munit.FunSuite {
61
62
62
63
val expectedScalaConfVersions = Seq (
63
64
Some (" 3" ) -> " 3.0.1" ,
65
+ Some (" 3.0" ) -> " 3.0.1" ,
64
66
None -> " 3.0.1" ,
65
67
Some (" 2.13" ) -> " 2.13.4" ,
66
68
Some (" 2.12" ) -> " 2.12.13" ,
You can’t perform that action at this time.
0 commit comments