forked from sbt/librarymanagement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes sbt/sbt#4975 This makes `CrossVersion.Disabled` a stable identifier by reverting `final def` back to `final val`. This is to fix Scala.JS build ``` [error] ScalaJSCrossVersion.scala:34:23: stable identifier required, but sbt.`package`.CrossVersion.Disabled found. [error] case CrossVersion.Disabled => [error] ^ [error] one error found [error] (Compile / compileIncremental) Compilation failed ``` ### notes - sbt#121 added `final val Disabled = sbt.librarymanagement.Disabled` but it was just a companion object - sbt#280 actually made it `final val Disabled = sbt.librarymanagement.Disabled()`, but this broke Cat's build that was calling `CrossVersion.Disabled()` - sbt#290 changed to `final def Disabled = sbt.librarymanagement.Disabled` and `object Disabled extends sbt.librarymanagement.Disabled` - This changes back to `final val Disabled = sbt.librarymanagement.Disabled` (but because we changed the companion object in sbt#290 that's ok)
- Loading branch information
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
core/src/test/scala/example/tests/CrossVersionCompatTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package example.tests | ||
|
||
import sbt.librarymanagement.{ CrossVersion, Disabled } | ||
import verify.BasicTestSuite | ||
|
||
object CrossVersionCompatTest extends BasicTestSuite { | ||
test("CrossVersion.Disabled is typed to be Disabled") { | ||
assert(CrossVersion.Disabled match { | ||
case _: Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("CrossVersion.Disabled functions as disabled") { | ||
assert(CrossVersion(CrossVersion.disabled, "1.0.0", "1.0") == None) | ||
assert(CrossVersion(CrossVersion.Disabled, "1.0.0", "1.0") == None) | ||
} | ||
|
||
test("CrossVersion.Disabled() is typed to be Disabled") { | ||
assert(CrossVersion.Disabled() match { | ||
case _: Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("CrossVersion.Disabled() functions as disabled") { | ||
assert(CrossVersion(CrossVersion.disabled, "1.0.0", "1.0") == None) | ||
assert(CrossVersion(CrossVersion.Disabled(), "1.0.0", "1.0") == None) | ||
} | ||
|
||
test("CrossVersion.Disabled is stable") { | ||
assert(CrossVersion.Disabled match { | ||
case CrossVersion.Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("sbt.librarymanagement.Disabled is typed to be Disabled") { | ||
assert(Disabled match { | ||
case _: Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("sbt.librarymanagement.Disabled is stable") { | ||
assert(Disabled match { | ||
case Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("sbt.librarymanagement.Disabled() is typed to be Disabled") { | ||
assert(Disabled() match { | ||
case _: Disabled => true | ||
case _ => false | ||
}) | ||
} | ||
|
||
test("CrossVersion.disabled is sbt.librarymanagement.Disabled") { | ||
assert(CrossVersion.disabled == Disabled) | ||
} | ||
|
||
test("CrossVersion.Disabled is sbt.librarymanagement.Disabled") { | ||
assert(CrossVersion.Disabled == Disabled) | ||
} | ||
|
||
test("CrossVersion.Disabled() is sbt.librarymanagement.Disabled") { | ||
assert(CrossVersion.Disabled() == Disabled) | ||
} | ||
} |