File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ trait PropertiesTrait {
5656 def scalaPropOrElse (name : String , alt : String ): String = scalaProps.getProperty(name, alt)
5757 def scalaPropOrEmpty (name : String ): String = scalaPropOrElse(name, " " )
5858 def scalaPropOrNone (name : String ): Option [String ] = Option (scalaProps.getProperty(name))
59-
59+
6060 /** Either the development or release version if known, otherwise
6161 * the empty string.
6262 */
@@ -73,7 +73,15 @@ trait PropertiesTrait {
7373 } else " "
7474 }
7575 }
76-
76+
77+ /** Whether the current version of compiler is experimental
78+ *
79+ * 1. Snapshot and nightly releases are experimental.
80+ * 2. Features supported by experimental versions of the compiler:
81+ * - research plugins
82+ */
83+ val experimental = versionString.contains(" SNAPSHOT" ) || versionString.contains(" NIGHTLY" )
84+
7785 val copyrightString = scalaPropOrElse(" copyright.string" , " (c) 2002-2017 LAMP/EPFL" )
7886
7987 /** This is the encoding to use reading in source files, overridden with -encoding
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ sealed trait Plugin {
2929 * Research plugin receives a phase plan and return a new phase plan, while
3030 * non-research plugin returns a list of phases to be inserted.
3131 */
32- def research : Boolean = isInstanceOf [ResearchPlugin ]
32+ def isResearch : Boolean = isInstanceOf [ResearchPlugin ]
3333
3434 /** A description of this plugin's options, suitable as a response
3535 * to the -help command-line option. Conventionally, the options
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package plugins
33
44import core ._
55import Contexts ._
6- import config .PathResolver
6+ import config .{ PathResolver , Properties }
77import dotty .tools .io ._
88import Phases ._
99import config .Printers .plugins .{ println => debug }
@@ -128,7 +128,12 @@ trait Plugins {
128128 val updatedPlan = Plugins .schedule(plan, pluginPhases)
129129
130130 // add research plugins
131- plugins.collect { case p : ResearchPlugin => p }.foldRight(updatedPlan) { (plug, plan) => plug.init(options(plug), plan) }
131+ if (Properties .experimental)
132+ plugins.collect { case p : ResearchPlugin => p }.foldRight(updatedPlan) {
133+ (plug, plan) => plug.init(options(plug), plan)
134+ }
135+ else
136+ updatedPlan
132137 }
133138}
134139
You can’t perform that action at this time.
0 commit comments