You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When enabled, all top-level definitions are annotated as
`@experimental`.
This implies that all experimental language features and definitions can
be used in this project.
Note that this does not change the strong guarantees on stability of
non-experimental code. The experimental features can only be used in a
experimental scope (transitively).
This flags does not affect the use of `ResearchPlugin`.
Follow up of
https://contributors.scala-lang.org/t/behaviour-of-experimental-in-scala-3/6309/27?u=nicolasstucki
Copy file name to clipboardExpand all lines: compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
+1
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,7 @@ trait CommonScalaSettings:
122
122
valexplainTypes:Setting[Boolean] =BooleanSetting("-explain-types", "Explain type errors in more detail (deprecated, use -explain instead).", aliases =List("--explain-types", "-explaintypes"))
123
123
valunchecked:Setting[Boolean] =BooleanSetting("-unchecked", "Enable additional warnings where generated code depends on assumptions.", initialValue =true, aliases =List("--unchecked"))
124
124
vallanguage:Setting[List[String]] =MultiStringSetting("-language", "feature", "Enable one or more language features.", aliases =List("--language"))
125
+
valexperimental:Setting[Boolean] =BooleanSetting("-experimental", "Annotate all top-level definitions with @experimental. This enables the use of experimental features anywhere in the project.")
125
126
126
127
/* Coverage settings */
127
128
valcoverageOutputDir=PathSetting("-coverage-out", "Destination for coverage classfiles and instrumentation data.", "", aliases =List("--coverage-out"))
Copy file name to clipboardExpand all lines: docs/_docs/reference/experimental/overview.md
+6
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,12 @@ They are enabled by importing the feature or using the `-language` compiler flag
21
21
In general, experimental language features can be imported in an experimental scope (see [experimental definitions](../other-new-features/experimental-defs.md)).
22
22
They can be imported at the top-level if all top-level definitions are `@experimental`.
23
23
24
+
### `-experimental` compiler flag
25
+
26
+
This flag enables the use of any experimental language feature in the project.
27
+
It does this by adding an `@experimental` annotation to all top-level definitions.
28
+
Hence, dependent projects also have to be experimental.
29
+
24
30
## Experimental language features supported by special compiler options
25
31
26
32
Some experimental language features that are still in research and development can be enabled with special compiler options. These include
0 commit comments