summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/run/t5905-features.scala3
3 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index c22dc564b2..54e444decf 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -576,6 +576,7 @@ class MutableSettings(val errorFn: String => Unit)
def tryToSet(args: List[String]) = {
val (strings, rest) = args span (x => !x.startsWith("-"))
strings foreach {
+ case "_" if choices.nonEmpty => choices foreach appendToValue
case s if choices.isEmpty || (choices contains s) => appendToValue(s)
case s => badChoice(s, name)
}
@@ -586,6 +587,8 @@ class MutableSettings(val errorFn: String => Unit)
def clear(): Unit = (v = Nil)
def unparse: List[String] = value map (name + ":" + _)
+ def contains(s: String) = value contains s
+
withHelpSyntax(name + ":<" + arg + ">")
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1004777f23..14aa25eeb8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -738,7 +738,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
val featureName = (nestedOwners map (_.name + ".")).mkString + featureTrait.name
def action(): Boolean = {
def hasImport = inferImplicit(EmptyTree: Tree, featureTrait.tpe, reportAmbiguous = true, isView = false, context).isSuccess
- def hasOption = settings.language.value exists (s => s == featureName || s == "_")
+ def hasOption = settings.language contains featureName
val OK = hasImport || hasOption
if (!OK) {
val Some(AnnotationInfo(_, List(Literal(Constant(featureDesc: String)), Literal(Constant(required: Boolean))), _)) =
diff --git a/test/files/run/t5905-features.scala b/test/files/run/t5905-features.scala
index fbffddf114..a3848eef2a 100644
--- a/test/files/run/t5905-features.scala
+++ b/test/files/run/t5905-features.scala
@@ -12,7 +12,8 @@ object Test extends DirectTest {
compileString(global)(code)
import global._
exitingTyper {
- def isFeature(s: Symbol) = s.annotations.exists((a: AnnotationInfo) => a.tpe <:< typeOf[scala.annotation.meta.languageFeature])
+ //def isFeature(s: Symbol) = s.annotations.exists((a: AnnotationInfo) => a.tpe <:< typeOf[scala.annotation.meta.languageFeature])
+ def isFeature(s: Symbol) = s hasAnnotation definitions.LanguageFeatureAnnot
val langf = definitions.languageFeatureModule.typeSignature
val feats = langf.declarations filter (s => isFeature(s)) map (_.name.decoded)
val xmen = langf.member(TermName("experimental")).typeSignature.declarations filter (s => isFeature(s)) map (s => s"experimental.${s.name.decoded}")