Skip to content

Commit

Permalink
Split research plugin from experimental compiler version (#19841)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Mar 4, 2024
2 parents bcbe6b2 + 8584bb8 commit 02cc983
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ object Feature:
do checkExperimentalFeature(s"feature $setting", NoSourcePosition)

def isExperimentalEnabled(using Context): Boolean =
(Properties.experimental && !ctx.settings.YnoExperimental.value) || ctx.settings.experimental.value
(Properties.unstableExperimentalEnabled && !ctx.settings.YnoExperimental.value) || ctx.settings.experimental.value

/** Handle language import `import language.<prefix>.<imported>` if it is one
* of the global imports `pureFunctions` or `captureChecking`. In this case
Expand Down
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/config/Properties.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ trait PropertiesTrait {

/** Whether the current version of compiler is experimental
*
* 1. Snapshot, nightly releases and non-bootstrapped compiler are experimental.
* 2. Features supported by experimental versions of the compiler:
* - research plugins
* Snapshot, nightly releases and non-bootstrapped compiler are experimental.
*/
val experimental: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") || versionString.contains("nonbootstrapped")
val unstableExperimentalEnabled: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") || versionString.contains("nonbootstrapped")

/** Whether the current version of compiler supports research plugins. */
val researchPluginEnabled: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") || versionString.contains("nonbootstrapped")

val copyrightString: String = scalaPropOrElse("copyright.string", "(c) 2002-2017 LAMP/EPFL")

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/plugins/Plugins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ trait Plugins {
val updatedPlan = Plugins.schedule(plan, pluginPhases)

// add research plugins
if Properties.experimental && !ctx.settings.YnoExperimental.value then
if Properties.researchPluginEnabled then
plugins.collect { case p: ResearchPlugin => p }.foldRight(updatedPlan) {
(plug, plan) => plug.init(options(plug), plan)
}
Expand Down

0 comments on commit 02cc983

Please sign in to comment.