Skip to content

Fix #4194: only enable research plugins on experimental compiler versions #4231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions compiler/src/dotty/tools/dotc/config/Properties.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ trait PropertiesTrait {
def scalaPropOrElse(name: String, alt: String): String = scalaProps.getProperty(name, alt)
def scalaPropOrEmpty(name: String): String = scalaPropOrElse(name, "")
def scalaPropOrNone(name: String): Option[String] = Option(scalaProps.getProperty(name))

/** Either the development or release version if known, otherwise
* the empty string.
*/
Expand All @@ -73,7 +73,15 @@ trait PropertiesTrait {
} else ""
}
}


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

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

/** This is the encoding to use reading in source files, overridden with -encoding
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/plugins/Plugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sealed trait Plugin {
* Research plugin receives a phase plan and return a new phase plan, while
* non-research plugin returns a list of phases to be inserted.
*/
def research: Boolean = isInstanceOf[ResearchPlugin]
def isResearch: Boolean = isInstanceOf[ResearchPlugin]

/** A description of this plugin's options, suitable as a response
* to the -help command-line option. Conventionally, the options
Expand Down
9 changes: 7 additions & 2 deletions compiler/src/dotty/tools/dotc/plugins/Plugins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package plugins

import core._
import Contexts._
import config.PathResolver
import config.{ PathResolver, Properties }
import dotty.tools.io._
import Phases._
import config.Printers.plugins.{ println => debug }
Expand Down Expand Up @@ -128,7 +128,12 @@ trait Plugins {
val updatedPlan = Plugins.schedule(plan, pluginPhases)

// add research plugins
plugins.collect { case p: ResearchPlugin => p }.foldRight(updatedPlan) { (plug, plan) => plug.init(options(plug), plan) }
if (Properties.experimental)
plugins.collect { case p: ResearchPlugin => p }.foldRight(updatedPlan) {
(plug, plan) => plug.init(options(plug), plan)
}
else
updatedPlan
}
}

Expand Down