Skip to content

Commit c32846c

Browse files
authored
Refine behavior of -Yno-experimental (#19741)
This is a first step towards the changes described in #19708 (comment). This makes testing `-experimental` a bit more robust.
2 parents da2b43f + 49e3250 commit c32846c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ object Feature:
163163
do checkExperimentalFeature(s"feature $setting", NoSourcePosition)
164164

165165
def isExperimentalEnabled(using Context): Boolean =
166-
(Properties.experimental || ctx.settings.experimental.value) && !ctx.settings.YnoExperimental.value
166+
(Properties.experimental && !ctx.settings.YnoExperimental.value) || ctx.settings.experimental.value
167167

168168
/** Handle language import `import language.<prefix>.<imported>` if it is one
169169
* of the global imports `pureFunctions` or `captureChecking`. In this case

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ private sealed trait YSettings:
397397
val YretainTrees: Setting[Boolean] = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree")
398398
val YshowTreeIds: Setting[Boolean] = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.")
399399
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.")
400-
val YnoExperimental: Setting[Boolean] = BooleanSetting("-Yno-experimental", "Disable experimental language features.")
400+
val YnoExperimental: Setting[Boolean] = BooleanSetting("-Yno-experimental", "Disable experimental language features by default in NIGHTLY/SNAPSHOT versions of the compiler.")
401401
val YlegacyLazyVals: Setting[Boolean] = BooleanSetting("-Ylegacy-lazy-vals", "Use legacy (pre 3.3.0) implementation of lazy vals.")
402402
val YcompileScala2Library: Setting[Boolean] = BooleanSetting("-Ycompile-scala2-library", "Used when compiling the Scala 2 standard library.")
403403
val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting("-Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles")

0 commit comments

Comments
 (0)