diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t5905-features.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5905-features.scala | 29 | ||||
-rw-r--r-- | test/files/run/t5905b-features.check | 1 | ||||
-rw-r--r-- | test/files/run/t5905b-features.scala | 15 |
4 files changed, 46 insertions, 0 deletions
diff --git a/test/files/run/t5905-features.flags b/test/files/run/t5905-features.flags new file mode 100644 index 0000000000..ad51758c39 --- /dev/null +++ b/test/files/run/t5905-features.flags @@ -0,0 +1 @@ +-nowarn diff --git a/test/files/run/t5905-features.scala b/test/files/run/t5905-features.scala new file mode 100644 index 0000000000..a3848eef2a --- /dev/null +++ b/test/files/run/t5905-features.scala @@ -0,0 +1,29 @@ + +import tools.partest.DirectTest + +// verify that all languageFeature names are accepted by -language +object Test extends DirectTest { + override def code = "class Code { def f = (1 to 10) size }" // exercise a feature + + override def extraSettings = s"-usejavacp -d ${testOutput.path}" + + override def show() = { + val global = newCompiler("-language:postfixOps", "-Ystop-after:typer") + 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 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}") + val all = (feats ++ xmen) mkString "," + + assert(feats.nonEmpty, "Test must find feature flags.") + + //dynamics,postfixOps,reflectiveCalls,implicitConversions,higherKinds,existentials,experimental.macros + compile(s"-language:$all") + } + } +} + diff --git a/test/files/run/t5905b-features.check b/test/files/run/t5905b-features.check new file mode 100644 index 0000000000..08c76d74aa --- /dev/null +++ b/test/files/run/t5905b-features.check @@ -0,0 +1 @@ +'noob' is not a valid choice for '-language' diff --git a/test/files/run/t5905b-features.scala b/test/files/run/t5905b-features.scala new file mode 100644 index 0000000000..627df8334b --- /dev/null +++ b/test/files/run/t5905b-features.scala @@ -0,0 +1,15 @@ + +import tools.partest.DirectTest + +// verify that only languageFeature names are accepted by -language +object Test extends DirectTest { + override def code = "class Code" + + override def extraSettings = s"-usejavacp -d ${testOutput.path}" + + override def show() = { + //compile("-language", "--") // no error + compile(s"-language:noob") + } +} + |