Skip to content

Commit

Permalink
remove 3.2-migration
Browse files Browse the repository at this point in the history
revert this commit if we actually need a 3.2 migration,
i.e. because we enable strict pattern matching
  • Loading branch information
bishabosha committed Mar 15, 2022
1 parent b5a98e7 commit 44f164f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/config/SourceVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import dotty.tools.dotc.core.Names.Name
*/
enum SourceVersion:
case `3.0-migration`, `3.0`, `3.1` // Note: do not add `3.1-migration` here, 3.1 is the same language as 3.0.
case `3.2`, `3.2-migration` // !!! DELETE `3.2-migration` BEFORE RELEASING 3.2.0 if we do not enable features from `future`
// case `3.2-migration` // !!! UNCOMMENT `3.2-migration` BEFORE RELEASING 3.2.0 if we enable features from `future`
case `3.2`
case `future-migration`, `future`

val isMigrating: Boolean = toString.endsWith("-migration")
Expand Down
65 changes: 39 additions & 26 deletions compiler/test/dotty/tools/dotc/config/SourceVersionTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class SourceVersionTest:
assertEquals(SourceVersion.`3.1`, importLanguageDot("3.1-migration"))

assertEquals(SourceVersion.`3.1`, importLanguageDot("3.1"))
assertEquals(SourceVersion.`3.2-migration`, importLanguageDot("3.2-migration"))
// assertEquals(SourceVersion.`3.2-migration`, importLanguageDot("3.2-migration")) // uncomment when we introduce `3.2-migration`
assertEquals(SourceVersion.`3.2`, importLanguageDot("3.2-migration")) // delete when we introduce `3.2-migration`
assertEquals(SourceVersion.`3.2`, importLanguageDot("3.2"))
assertEquals(SourceVersion.`future-migration`, importLanguageDot("future-migration"))
assertEquals(SourceVersion.`future`, importLanguageDot("future"))
Expand All @@ -26,67 +27,79 @@ class SourceVersionTest:
assertEquals(SourceVersion.`3.0`, SourceVersion.`3.0-migration`.series)
assertEquals(SourceVersion.`3.0`, SourceVersion.`3.0`.series)
assertEquals(SourceVersion.`3.0`, SourceVersion.`3.1`.series)
assertEquals(SourceVersion.`3.2`, SourceVersion.`3.2-migration`.series)
assertEquals(SourceVersion.`3.2`, SourceVersion.`3.2`.series)
// assertEquals(SourceVersion.`3.2`, SourceVersion.`3.2-migration`.series) // uncomment when we introduce `3.2-migration`
// assertEquals(SourceVersion.`3.2`, SourceVersion.`3.2`.series) // uncomment when we introduce `3.2-migration`
assertEquals(SourceVersion.`3.0`, SourceVersion.`3.2`.series) // delete when we introduce `3.2-migration`
assertEquals(SourceVersion.`future`, SourceVersion.`future-migration`.series)
assertEquals(SourceVersion.`future`, SourceVersion.`future`.series)

@Test def `isAtLeast 3.0`: Unit =
// trues
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.2`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.1`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0-migration`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.2`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.0-migration`))
assertTrue(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.2`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.0-migration`))
assertTrue(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.2`)) // delete when we introduce `3.2-migration`
assertTrue(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.0-migration`))


// falses
assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`future`))
assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`future-migration`))
assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.2`))
assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.2-migration`))
// assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.2`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.0-migration`.isAtLeast(SourceVersion.`3.2-migration`)) // uncomment when we introduce `3.2-migration`
assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`future`))
assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`future-migration`))
assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.2`))
assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.2-migration`))
// assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.2`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.0`.isAtLeast(SourceVersion.`3.2-migration`)) // uncomment when we introduce `3.2-migration`
assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`future`))
assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`future-migration`))
assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.2`))
assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.2-migration`))
// assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.2`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.1`.isAtLeast(SourceVersion.`3.2-migration`)) // uncomment when we introduce `3.2-migration
assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future`)) // delete when we introduce `3.2-migration`
assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future-migration`)) // delete when we introduce `3.2-migration`

@Test def `isAtLeast 3.2`: Unit =
// @Test def `isAtLeast 3.2`: Unit = // uncomment when we introduce `3.2-migration`
// trues
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.2`))
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.2-migration`))
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0-migration`))
assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.2`))
assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.2-migration`))
assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.0-migration`))
// assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.2`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.2-migration`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.1`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2`.isAtLeast(SourceVersion.`3.0-migration`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.2`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.2-migration`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.1`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.0`)) // uncomment when we introduce `3.2-migration`
// assertTrue(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`3.0-migration`)) // uncomment when we introduce `3.2-migration`
// falses
assertFalse(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`future`))
assertFalse(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`future-migration`))
assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future`))
assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future-migration`))
// assertFalse(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`future`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.2-migration`.isAtLeast(SourceVersion.`future-migration`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future`)) // uncomment when we introduce `3.2-migration`
// assertFalse(SourceVersion.`3.2`.isAtLeast(SourceVersion.`future-migration`)) // uncomment when we introduce `3.2-migration`

@Test def `isAtLeast future`: Unit =
// trues
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`future`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`future-migration`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.2`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.2-migration`))
// assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.2-migration`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`future`.isAtLeast(SourceVersion.`3.0-migration`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`future`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`future-migration`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.2`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.2-migration`))
// assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.2-migration`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.1`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.0`))
assertTrue(SourceVersion.`future-migration`.isAtLeast(SourceVersion.`3.0-migration`))
Expand Down

0 comments on commit 44f164f

Please sign in to comment.