Skip to content

Commit f187bde

Browse files
committed
SI-9377 ScalaVersion init no longer fails if versionless
If the version string was empty, ScalaVersion would indignantly refuse to initialize. Now it takes a missing property as "none".
1 parent 5330319 commit f187bde

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/compiler/scala/tools/nsc/settings/ScalaVersion.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ object ScalaVersion {
9797

9898
versionString match {
9999
case "none" => NoScalaVersion
100+
case "" => NoScalaVersion
100101
case "any" => AnyScalaVersion
101102
case vpat(majorS, minorS, revS, buildS) =>
102103
SpecificScalaVersion(toInt(majorS), toInt(minorS), toInt(revS), toBuild(buildS))

test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ class ScalaVersionTest {
5757
assertThrows[NumberFormatException] { ScalaVersion("2-.") } // scalacheck territory
5858
assertThrows[NumberFormatException] { ScalaVersion("any.7") }
5959
}
60+
61+
// SI-9377
62+
@Test def `missing version is as good as none`() {
63+
assertEquals(NoScalaVersion, ScalaVersion(""))
64+
}
6065
}

0 commit comments

Comments
 (0)