Skip to content

Commit 014831e

Browse files
committed
Enable kind polimorphism
Enable kind polimorphism by default by replacing `-Ykind-polymorphism` with `-Yno-kind-polymorphism`.
1 parent 751c84c commit 014831e

File tree

12 files changed

+7
-6
lines changed

12 files changed

+7
-6
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class ScalaSettings extends Settings.SettingGroup {
138138
//.withPostSetHook( _ => YprofileEnabled.value = true )
139139

140140
// Extremely experimental language features
141-
val YkindPolymorphism: Setting[Boolean] = BooleanSetting("-Ykind-polymorphism", "Enable kind polymorphism (see http://dotty.epfl.ch/docs/reference/kind-polymorphism.html). Potentially unsound.")
141+
val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting("-Yno-kind-polymorphism", "Enable kind polymorphism (see http://dotty.epfl.ch/docs/reference/kind-polymorphism.html). Potentially unsound.")
142142

143143
/** Area-specific debug output */
144144
val YexplainLowlevel: Setting[Boolean] = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.")

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class Definitions {
320320

321321
lazy val AnyKindClass: ClassSymbol = {
322322
val cls = ctx.newCompleteClassSymbol(ScalaPackageClass, tpnme.AnyKind, AbstractFinal | Permanent, Nil)
323-
if (ctx.settings.YkindPolymorphism.value) {
323+
if (!ctx.settings.YnoKindPolymorphism.value) {
324324
// Enable kind-polymorphism by exposing scala.AnyKind
325325
cls.entered
326326
}

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class CompilationTests extends ParallelTesting {
9191
compileFilesInDir("tests/pos-scala2", scala2Mode) +
9292
compileFilesInDir("tests/pos", defaultOptions) +
9393
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes) +
94-
compileFilesInDir("tests/pos-kind-polymorphism", defaultOptions and "-Ykind-polymorphism") +
9594
compileFile(
9695
// succeeds despite -Xfatal-warnings because of -nowarn
9796
"tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
@@ -145,7 +144,7 @@ class CompilationTests extends ParallelTesting {
145144
implicit val testGroup: TestGroup = TestGroup("compileNeg")
146145
compileFilesInDir("tests/neg", defaultOptions) +
147146
compileFilesInDir("tests/neg-tailcall", defaultOptions) +
148-
compileFilesInDir("tests/neg-kind-polymorphism", defaultOptions and "-Ykind-polymorphism") +
147+
compileFilesInDir("tests/neg-no-kind-polymorphism", defaultOptions and "-Yno-kind-polymorphism") +
149148
compileFilesInDir("tests/neg-custom-args/deprecation", defaultOptions.and("-Xfatal-warnings", "-deprecation")) +
150149
compileFilesInDir("tests/neg-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")) +
151150
compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings) +

docs/docs/reference/other-new-features/kind-polymorphism.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ It is declared `abstract` and `final`, so it can be neither instantiated nor ext
4242

4343
`AnyKind` plays a special role in Scala's subtype system: It is a supertype of all other types no matter what their kind is. It is also assumed to be kind-compatible with all other types. Furthermore, `AnyKind` is treated as a higher-kinded type (so it cannot be used as a type of values), but at the same time it has no type parameters (so it cannot be instantiated).
4444

45-
**Note**: This feature is considered experimental and is only enabled under a compiler flag
46-
(i.e. `-Ykind-polymorphism`).
45+
**Note**: This feature is considered experimental but stable and it can be disabled under compiler flag
46+
(i.e. `-Yno-kind-polymorphism`).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
trait Foo[T <: AnyKind] // error: Not found: type AnyKind
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)