File tree 3 files changed +18
-5
lines changed
compiler/src/dotty/tools/dotc 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ trait PropertiesTrait {
56
56
def scalaPropOrElse (name : String , alt : String ): String = scalaProps.getProperty(name, alt)
57
57
def scalaPropOrEmpty (name : String ): String = scalaPropOrElse(name, " " )
58
58
def scalaPropOrNone (name : String ): Option [String ] = Option (scalaProps.getProperty(name))
59
-
59
+
60
60
/** Either the development or release version if known, otherwise
61
61
* the empty string.
62
62
*/
@@ -73,7 +73,15 @@ trait PropertiesTrait {
73
73
} else " "
74
74
}
75
75
}
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
+
77
85
val copyrightString = scalaPropOrElse(" copyright.string" , " (c) 2002-2017 LAMP/EPFL" )
78
86
79
87
/** 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 {
29
29
* Research plugin receives a phase plan and return a new phase plan, while
30
30
* non-research plugin returns a list of phases to be inserted.
31
31
*/
32
- def research : Boolean = isInstanceOf [ResearchPlugin ]
32
+ def isResearch : Boolean = isInstanceOf [ResearchPlugin ]
33
33
34
34
/** A description of this plugin's options, suitable as a response
35
35
* 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
3
3
4
4
import core ._
5
5
import Contexts ._
6
- import config .PathResolver
6
+ import config .{ PathResolver , Properties }
7
7
import dotty .tools .io ._
8
8
import Phases ._
9
9
import config .Printers .plugins .{ println => debug }
@@ -128,7 +128,12 @@ trait Plugins {
128
128
val updatedPlan = Plugins .schedule(plan, pluginPhases)
129
129
130
130
// 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
132
137
}
133
138
}
134
139
You can’t perform that action at this time.
0 commit comments