Skip to content

Commit 25970ae

Browse files
committed
Disable experimental by default in unstable builds
1 parent 055653c commit 25970ae

File tree

25 files changed

+34
-37
lines changed

25 files changed

+34
-37
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,14 @@ object Feature:
163163
s"""Experimental $which may only be used under experimental mode:
164164
| 1. in a definition marked as @experimental, or
165165
| 2. an experimental feature is imported at the package level, or
166-
| 3. compiling with the -experimental compiler flag, or
167-
| 4. with a nightly or snapshot version of the compiler.
166+
| 3. compiling with the -experimental compiler flag.
168167
|""".stripMargin
169168

170169
def isExperimentalEnabled(using Context): Boolean =
171-
(Properties.unstableExperimentalEnabled && !ctx.settings.YnoExperimental.value) ||
172170
ctx.settings.experimental.value ||
173171
experimentalAutoEnableFeatures.exists(enabled)
174172

175173
def isExperimentalEnabledBySetting(using Context): Boolean =
176-
(Properties.unstableExperimentalEnabled && !ctx.settings.YnoExperimental.value) ||
177174
ctx.settings.experimental.value ||
178175
experimentalAutoEnableFeatures.exists(enabledBySetting)
179176

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ trait PropertiesTrait {
8484
*/
8585
val versionString: String = "version " + simpleVersionString
8686

87-
/** Whether the current version of compiler is experimental
88-
*
89-
* Snapshot, nightly releases and non-bootstrapped compiler are experimental.
90-
*/
91-
val unstableExperimentalEnabled: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") || versionString.contains("nonbootstrapped")
92-
9387
/** Whether the current version of compiler supports research plugins. */
9488
val researchPluginEnabled: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") || versionString.contains("nonbootstrapped")
9589

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ private sealed trait YSettings:
402402
val YretainTrees: Setting[Boolean] = BooleanSetting(ForkSetting, "Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree")
403403
val YshowTreeIds: Setting[Boolean] = BooleanSetting(ForkSetting, "Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.")
404404
val YfromTastyIgnoreList: Setting[List[String]] = MultiStringSetting(ForkSetting, "Yfrom-tasty-ignore-list", "file", "List of `tasty` files in jar files that will not be loaded when using -from-tasty.")
405-
val YnoExperimental: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-experimental", "Disable experimental language features by default in NIGHTLY/SNAPSHOT versions of the compiler.")
405+
val YnoExperimental: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-experimental", "Disable experimental language features by default in NIGHTLY/SNAPSHOT versions of the compiler (deprecated, no-op).")
406406
val YlegacyLazyVals: Setting[Boolean] = BooleanSetting(ForkSetting, "Ylegacy-lazy-vals", "Use legacy (pre 3.3.0) implementation of lazy vals.")
407407
val YcompileScala2Library: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycompile-scala2-library", "Used when compiling the Scala 2 standard library.")
408408
val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles")

compiler/test/dotty/tools/backend/jvm/PublicInBinaryTests.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class PublicInBinaryTests extends DottyBytecodeTest {
4242
override def initCtx =
4343
val ctx0 = super.initCtx
4444
ctx0.setSetting(ctx0.settings.experimental, true)
45-
ctx0.setSetting(ctx0.settings.YnoExperimental, true)
4645

4746
@Test
4847
def publicInBinaryDef(): Unit = {

docs/_docs/reference/other-new-features/experimental-defs.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ Experimental definitions can only be referenced in an experimental scope. Experi
265265

266266
</details>
267267

268-
6. Any code compiled using a [_Nightly_](https://search.maven.org/artifact/org.scala-lang/scala3-compiler_3) or _Snapshot_ version of the compiler is considered to be in an experimental scope.
269-
Can use the `-Yno-experimental` compiler flag to disable it and run as a proper release.
270-
271-
7. An experimental language feature is imported in at the package level. All top-level definitions will be marked as `@experimental`.
268+
6. An experimental language feature is imported in at the package level. All top-level definitions will be marked as `@experimental`.
272269

273270
In any other situation, a reference to an experimental definition will cause a compilation error.
274271

project/Build.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,9 @@ object Build {
17491749
SourceLinksIntegrationTest / scalaSource := baseDirectory.value / "test-source-links",
17501750
SourceLinksIntegrationTest / test:= ((SourceLinksIntegrationTest / test) dependsOn generateScalaDocumentation.toTask("")).value,
17511751
).
1752+
settings(
1753+
scalacOptions += "-experimental" // workaround use of experimental .info in Scaladoc2AnchorCreator
1754+
).
17521755
settings(
17531756
Compile / resourceGenerators ++= Seq(
17541757
generateStaticAssetsTask.taskValue,

scaladoc-testcases/src/tests/hugetype.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait E:
3131
@deprecated
3232
protected implicit def same[A](a: A): A
3333

34-
trait XD extends E:
34+
@experimental trait XD extends E:
3535
/**
3636
* Some important information :o
3737
*

scaladoc-testcases/src/tests/methodsAndConstructors.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package tests.methodsAndConstructors
22

3+
import scala.language.experimental.clauseInterleaving
4+
35
class A
46
class B extends A
57
class C
@@ -60,8 +62,6 @@ class Methods:
6062
def withImplicitParam2(v: String)(implicit ab: Double, a: Int, b: String): String
6163
= ???
6264

63-
import scala.language.experimental.clauseInterleaving
64-
6565
def clauseInterleaving[T](x: T)[U](y: U)(using (T, U)): (T, U)
6666
= ???
6767

scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompiler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class SnippetCompiler(
2727
object SnippetDriver extends Driver:
2828
val currentCtx =
2929
val rootCtx = initCtx.fresh.addMode(Mode.ReadPositions).addMode(Mode.Interactive)
30-
rootCtx.setSetting(rootCtx.settings.YnoExperimental, true)
3130
rootCtx.setSetting(rootCtx.settings.experimental, true)
3231
rootCtx.setSetting(rootCtx.settings.YretainTrees, true)
3332
rootCtx.setSetting(rootCtx.settings.YcookComments, true)

tests/neg/experimental-message-experimental-flag.check

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
| Experimental definition may only be used under experimental mode:
88
| 1. in a definition marked as @experimental, or
99
| 2. an experimental feature is imported at the package level, or
10-
| 3. compiling with the -experimental compiler flag, or
11-
| 4. with a nightly or snapshot version of the compiler.
10+
| 3. compiling with the -experimental compiler flag.

0 commit comments

Comments
 (0)