diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 0bb64d78370b..3dbfbfc6bab9 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -347,7 +347,6 @@ private sealed trait YSettings: val YprintPos: Setting[Boolean] = BooleanSetting("-Yprint-pos", "Show tree positions.") val YprintPosSyms: Setting[Boolean] = BooleanSetting("-Yprint-pos-syms", "Show symbol definitions positions.") val YnoDeepSubtypes: Setting[Boolean] = BooleanSetting("-Yno-deep-subtypes", "Throw an exception on deep subtyping call stacks.") - val YnoLegacyMatchTypes: Setting[Boolean] = BooleanSetting("-Yno-legacy-match-types", "Refuse to reduce match types with legacy/unspecified patterns") val YnoPatmatOpt: Setting[Boolean] = BooleanSetting("-Yno-patmat-opt", "Disable all pattern matching optimizations.") val YplainPrinter: Setting[Boolean] = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.") val YprintSyms: Setting[Boolean] = BooleanSetting("-Yprint-syms", "When printing trees print info in symbols instead of corresponding info in trees.") diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 75254883a732..0c516a2ad6c4 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -10,8 +10,9 @@ import TypeOps.refineUsingParent import collection.mutable import util.{Stats, NoSourcePosition, EqHashMap} import config.Config -import config.Feature.migrateTo3 +import config.Feature.{migrateTo3, sourceVersion} import config.Printers.{subtyping, gadts, matchTypes, noPrinter} +import config.SourceVersion import TypeErasure.{erasedLub, erasedGlb} import TypeApplications._ import Variances.{Variance, variancesConform} @@ -3455,7 +3456,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) { MatchResult.Stuck def recur(remaining: List[MatchTypeCaseSpec]): Type = remaining match - case (cas: MatchTypeCaseSpec.LegacyPatMat) :: _ if ctx.settings.YnoLegacyMatchTypes.value => + case (cas: MatchTypeCaseSpec.LegacyPatMat) :: _ if sourceVersion.isAtLeast(SourceVersion.`3.4`) => val errorText = MatchTypeTrace.legacyPatternText(scrut, cas) ErrorType(reporting.MatchTypeLegacyPattern(errorText)) case cas :: remaining1 => diff --git a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala index c5904b0d7d38..5d2992b50a09 100644 --- a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala +++ b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala @@ -19,7 +19,6 @@ object TestConfiguration { val checkOptions = Array( // "-Yscala2-unpickler", s"${Properties.scalaLibrary}", "-Yno-deep-subtypes", - "-Yno-legacy-match-types", "-Yno-double-bindings", "-Yforce-sbt-phases", "-Xsemanticdb", diff --git a/tests/neg/6570.scala b/tests/neg/6570.scala index 9a4b69c98e71..219844541357 100644 --- a/tests/neg/6570.scala +++ b/tests/neg/6570.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 object Base { trait Trait1 diff --git a/tests/pos/10747-shapeless-min.scala b/tests/pos/10747-shapeless-min.scala index f187f98c5dce..50f96ceb0bd0 100644 --- a/tests/pos/10747-shapeless-min.scala +++ b/tests/pos/10747-shapeless-min.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 trait Monoidal { type to[_] <: Tuple diff --git a/tests/pos/8647.scala b/tests/pos/8647.scala index 629a7489d876..7b420aa88d63 100644 --- a/tests/pos/8647.scala +++ b/tests/pos/8647.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 final class Two[A, B]() diff --git a/tests/pos/9757.scala b/tests/pos/9757.scala index 9b0559a87750..e0429429cbc2 100644 --- a/tests/pos/9757.scala +++ b/tests/pos/9757.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 type RemoveFrom[R, A] = R match { case A & newType => newType diff --git a/tests/pos/i10242.scala b/tests/pos/i10242.scala index 81dd0a9e2333..294404dfe33b 100644 --- a/tests/pos/i10242.scala +++ b/tests/pos/i10242.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 // https://github.com/lampepfl/dotty/issues/10242 type Foo[A, B <: A] = A diff --git a/tests/pos/i15155.scala b/tests/pos/i15155.scala index 41271d31974a..6d8bdabb039f 100644 --- a/tests/pos/i15155.scala +++ b/tests/pos/i15155.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 import scala.reflect.ClassTag // https://github.com/json4s/json4s/blob/355d8751391773e0d79d04402a4f9fb7bfc684ec/ext/src/main/scala-3/org/json4s/ext/package.scala#L4-L8 diff --git a/tests/pos/i16706.scala b/tests/pos/i16706.scala index 6bded0748a0e..66a119b56678 100644 --- a/tests/pos/i16706.scala +++ b/tests/pos/i16706.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 import scala.deriving.Mirror import scala.reflect.ClassTag diff --git a/tests/pos/i17395.scala b/tests/pos/i17395.scala index f045e72b56b6..7f5ab82268c6 100644 --- a/tests/pos/i17395.scala +++ b/tests/pos/i17395.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 trait TC[T] diff --git a/tests/pos/i5625b.scala b/tests/pos/i5625b.scala index fad0628b28d5..c24411516486 100644 --- a/tests/pos/i5625b.scala +++ b/tests/pos/i5625b.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 object Test { diff --git a/tests/run-macros/tasty-simplified/quoted_2.scala b/tests/run-macros/tasty-simplified/quoted_2.scala index 8b4994e8fdd4..215c67fcd1ee 100644 --- a/tests/run-macros/tasty-simplified/quoted_2.scala +++ b/tests/run-macros/tasty-simplified/quoted_2.scala @@ -1,4 +1,4 @@ -// scalac: -Yno-legacy-match-types:false +// scalac: -source:3.3 import Macros.simplified