From d7f5ee5dcf6ddeb67baa6d4bc433d971c972a087 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Mon, 7 Mar 2022 13:10:20 +0100 Subject: [PATCH] remove 3.2-migration revert this commit if we actually need a 3.2 migration, i.e. because we enable strict pattern matching --- .../tools/dotc/config/SourceVersion.scala | 3 +- .../tools/dotc/config/SourceVersionTest.scala | 65 +++++++++++-------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/config/SourceVersion.scala b/compiler/src/dotty/tools/dotc/config/SourceVersion.scala index ad80276f5d1a..abe8ee0a31f4 100644 --- a/compiler/src/dotty/tools/dotc/config/SourceVersion.scala +++ b/compiler/src/dotty/tools/dotc/config/SourceVersion.scala @@ -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") diff --git a/compiler/test/dotty/tools/dotc/config/SourceVersionTest.scala b/compiler/test/dotty/tools/dotc/config/SourceVersionTest.scala index ea91d6720cd1..ec8c03e43b9b 100644 --- a/compiler/test/dotty/tools/dotc/config/SourceVersionTest.scala +++ b/compiler/test/dotty/tools/dotc/config/SourceVersionTest.scala @@ -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")) @@ -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`))