Skip to content

Commit eb7b632

Browse files
authored
Merge pull request #11916 from dotty-staging/revert-11852
Revert #11852: only enable experimental features for snapshot and nightly
2 parents 43a73a3 + ccc7c4f commit eb7b632

File tree

66 files changed

+67
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+67
-134
lines changed

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ lazy val compilerVersion: String =
1010
val file = communitybuildDir.resolve("scala3-bootstrapped.version")
1111
new String(Files.readAllBytes(file), UTF_8)
1212

13-
lazy val compilerSupportExperimental: Boolean =
14-
compilerVersion.contains("SNAPSHOT") || compilerVersion.contains("NIGHTLY")
15-
1613
lazy val sbtPluginFilePath: String =
1714
// Workaround for https://github.com/sbt/sbt/issues/4395
1815
new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs()

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class CommunityBuildTestB extends CommunityBuildTest:
116116
@Test def disciplineSpecs2 = projects.disciplineSpecs2.run()
117117
@Test def munit = projects.munit.run()
118118
@Test def perspective = projects.perspective.run()
119-
@Test def scodec = if (compilerSupportExperimental) projects.scodec.run()
119+
@Test def scodec = projects.scodec.run()
120120
@Test def scodecBits = projects.scodecBits.run()
121121
@Test def simulacrumScalafixAnnotations = projects.simulacrumScalafixAnnotations.run()
122122
end CommunityBuildTestB

compiler/src/dotty/tools/dotc/Driver.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class Driver {
7777
val ictx = rootCtx.fresh
7878
val summary = command.distill(args, ictx.settings)(ictx.settingsState)(using ictx)
7979
ictx.setSettings(summary.sstate)
80-
Feature.checkExperimentalFlags(using ictx)
8180
MacroClassLoader.init(ictx)
8281
Positioned.init(using ictx)
8382

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
279279

280280
def isLanguageImport(path: Tree): Boolean = languageImport(path).isDefined
281281

282-
def isExperimentalImport(path: Tree): Boolean =
283-
languageImport(path) match
284-
case Some(nme.experimental) => true
285-
case _ => false
286-
287282
/** The underlying pattern ignoring any bindings */
288283
def unbind(x: Tree): Tree = unsplice(x) match {
289284
case Bind(_, y) => unbind(y)

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,7 @@ object Feature:
2828
val symbolLiterals = deprecated("symbolLiterals")
2929
val fewerBraces = experimental("fewerBraces")
3030

31-
val experimentalWarningMessage = "Experimental features may only be used with nightly or snapshot version of compiler."
32-
33-
/** Experimental features are only enabled for snapshot and nightly compiler versions
34-
*/
35-
def experimentalEnabled(using Context): Boolean =
36-
Properties.experimental && !ctx.settings.YnoExperimental.value
37-
38-
def isExperimental(feature: TermName): Boolean =
39-
feature != scala2macros && feature.match
40-
case QualifiedName(nme.experimental, _) => true
41-
case _ => false
42-
43-
/** Is `feature` enabled by by a command-line setting? The enabling setting is
31+
/** Is `feature` enabled by by a command-line setting? The enabling setting is
4432
*
4533
* -language:<prefix>feature
4634
*
@@ -68,12 +56,9 @@ object Feature:
6856
* @param feature The name of the feature
6957
* @param owner The prefix symbol (nested in `scala.language`) where the
7058
* feature is defined.
71-
*
72-
* Note: Experimental features are only enabled for snapshot and nightly version of compiler.
7359
*/
7460
def enabled(feature: TermName)(using Context): Boolean =
75-
(experimentalEnabled || !isExperimental(feature))
76-
&& (enabledBySetting(feature) || enabledByImport(feature))
61+
enabledBySetting(feature) || enabledByImport(feature)
7762

7863
/** Is auto-tupling enabled? */
7964
def autoTuplingEnabled(using Context): Boolean = !enabled(nme.noAutoTupling)
@@ -86,8 +71,6 @@ object Feature:
8671

8772
def genericNumberLiteralsEnabled(using Context) = enabled(genericNumberLiterals)
8873

89-
def erasedEnabled(using Context) = enabled(Feature.erasedDefinitions)
90-
9174
def scala2ExperimentalMacroEnabled(using Context) = enabled(scala2macros)
9275

9376
def sourceVersionSetting(using Context): SourceVersion =
@@ -114,16 +97,4 @@ object Feature:
11497
else
11598
false
11699

117-
/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
118-
def checkExperimentalFlags(using Context): Unit =
119-
if !experimentalEnabled then
120-
val features = ctx.settings.language.value.filter { feature =>
121-
feature.contains(nme.experimental.toString) && !feature.contains("macros")
122-
}
123-
if features.nonEmpty then
124-
report.error(
125-
experimentalWarningMessage +
126-
"\nThe experimental language features are enabled via -language:" + features.mkString(",")
127-
)
128-
129100
end Feature

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import java.nio.charset.StandardCharsets
1111
/** Loads `library.properties` from the jar. */
1212
object Properties extends PropertiesTrait {
1313
protected def propCategory: String = "compiler"
14-
protected def pickJarBasedOn: Class[PropertiesTrait] = classOf[PropertiesTrait]
14+
protected def pickJarBasedOn: Class[Option[?]] = classOf[Option[?]]
1515

1616
/** Scala manifest attributes.
1717
*/

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
215215
val YretainTrees: Setting[Boolean] = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree")
216216
val YshowTreeIds: Setting[Boolean] = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.")
217217
val YfromTastyIgnoreList: Setting[List[String]] = MultiStringSetting("-Yfrom-tasty-ignore-list", "file", "List of `tasty` files in jar files that will not be loaded when using -from-tasty")
218-
val YnoExperimental: Setting[Boolean] = BooleanSetting("-Yno-experimental", "Disable experimental language features")
219218

220219
val YprofileEnabled: Setting[Boolean] = BooleanSetting("-Yprofile-enabled", "Enable profiling.")
221220
val YprofileDestination: Setting[String] = StringSetting("-Yprofile-destination", "file", "Where to send profiling output - specify a file, default is to the console.", "")

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ object StdNames {
520520
val longHash: N = "longHash"
521521
val macroThis : N = "_this"
522522
val macroContext : N = "c"
523-
val macros: N = "macros"
524523
val main: N = "main"
525524
val manifest: N = "manifest"
526525
val ManifestFactory: N = "ManifestFactory"

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import config.Feature
3232
import config.Feature.{sourceVersion, migrateTo3}
3333
import config.SourceVersion._
3434
import config.SourceVersion
35-
import config.Properties
3635

3736
object Parsers {
3837

@@ -3080,11 +3079,6 @@ object Parsers {
30803079
val imp = Import(tree, selectors)
30813080
if isLanguageImport(tree) then
30823081
in.languageImportContext = in.languageImportContext.importContext(imp, NoSymbol)
3083-
if isExperimentalImport(tree)
3084-
&& !Feature.experimentalEnabled
3085-
&& selectors.exists(_.name != nme.macros)
3086-
then
3087-
report.error(Feature.experimentalWarningMessage, imp.srcPos)
30883082
for
30893083
case ImportSelector(id @ Ident(imported), EmptyTree, _) <- selectors
30903084
if allSourceVersionNames.contains(imported)

0 commit comments

Comments
 (0)