SI-5905 Sanity check -language options #3597

Merged
merged 3 commits into from May 9, 2014

Projects

None yet

3 participants

@som-snytt

The option names are hardcoded, but checked by a test.

There are no hooks to verify options after the compiler
is constructed.

Introduced a MultiChoiceSetting required for the
setting creation framework.

@som-snytt som-snytt SI-5905 Sanity check -language options
The option names are hardcoded, but checked by a test.

There are no hooks to verify options after the compiler
is constructed.

Introduced a `MultiChoiceSetting` required for the
setting creation framework.
a40af3e
@som-snytt som-snytt added tested and removed needs-attention labels Feb 28, 2014
@som-snytt som-snytt closed this Feb 28, 2014
@som-snytt

Closed until there's way to propose a PR that's not RC.

@som-snytt som-snytt reopened this Mar 2, 2014
@som-snytt som-snytt added tested and removed tested labels Mar 2, 2014
@som-snytt som-snytt closed this Mar 2, 2014
@som-snytt

Reopening for tweaked underscore handling.

@som-snytt som-snytt reopened this Mar 2, 2014
@som-snytt som-snytt added tested and removed tested labels Mar 2, 2014
@som-snytt som-snytt SI-5905 Restore -language:_
Underscore means all.

-x:c,b,a,_ results in value c,b,a,a,b,c,d,...

Currently, -Xprint does not present phases as a closed
set of choices; there is ad hoc checking in Global.
That would be a nice unification. (You don't know the
list of choices until after global is constructed.)
534cadc
@som-snytt som-snytt added tested and removed tested labels Mar 3, 2014
@som-snytt

Suspended animation.

@som-snytt som-snytt closed this Mar 3, 2014
@som-snytt

Reanimating.

@som-snytt som-snytt reopened this Mar 11, 2014
@som-snytt

I see from another PR that there's an on-hold label used to park PRs? That would be a PRK.

@som-snytt

@adriaanm I know it's not your job anymore, but should I ping someone before I have to rebase? Pretty soon it will be summer vacation and all of Europe will be hiking in the Alps.

@adriaanm
The Scala Programming Language member

I'm back -- in the Olde Country safe haven. Taking a few more days to adapt to the air, but then I'll be back to terrorizing the PR queue. @retronym is tending to our branches. I believe this one is good to go for review & inclusion in 2.11.1.

@retronym retronym and 1 other commented on an outdated diff May 7, 2014
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
@retronym
retronym May 7, 2014

I don't understand the need for this.

The following variation of this test passes without this.

import tools.partest.DirectTest

// verify that all languageFeature names are accepted by -language
object Test extends DirectTest {
  override def code = ""

  override def extraSettings = s"-usejavacp -d ${testOutput.path}"

  override def show() = {
    val global = newCompiler("")
    new global.Run()
    import global._, global.definitions._

    exitingTyper {
      def isFeature(s: Symbol) = s hasAnnotation LanguageFeatureAnnot
      val langf  = 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")
    }
  }
}
@som-snytt
som-snytt May 7, 2014

Searching my memory with async i/o, so while I'm waiting for that result, my guess is that I wanted it to emit a warning if the feature flag was wrongly omitted from the test. Properly, it would exercise all features and ensure no warnings, including no warning about bad flags.

No wait, I didn't read "after the jump." I'll check on it and amend with corrections and explanatory comments.

Rhetorical edit: was I just being paranoid about global init?

@retronym
The Scala Programming Language member

Can I buy an "S" for the title of the latest commit?

@som-snytt som-snytt SI-5905 Clarify test case
The language feature options are discovered reflectively, but it
is nice to enforce that expected options are supplied.

Short of that, the code string includes a rowdy postfix operator.

It still does enforce that at least one option was discovered.

Delete -nowarn flags file. Let's see if that was to suppress
a warning in the standard build.
78bd175
@som-snytt

orry about that.

Grabbing text with the mouse in a terminal window is often off by one for me. I can't get the hang of these newfangled UIs.

@adriaanm
The Scala Programming Language member

LGTM

@retronym retronym merged commit 6f33b24 into scala:master May 9, 2014
@adriaanm
The Scala Programming Language member

somehow this commit snuck past PR validation, but not past scala-checkin: https://scala-webapps.epfl.ch/jenkins/job/scala-checkin/8994/consoleFull /cc @retronym, @lrytz

The Scala Programming Language member

I'll submit a fix.

The Scala Programming Language member

thanks

Let's see if that was to suppress a warning in the standard build.

I guess that would be a yes.

@retronym retronym added a commit to retronym/scala that referenced this pull request May 9, 2014
@retronym retronym Revert "SI-5905 Clarify test case"
This reverts commit 78bd175.

See discussion:

  scala#3597 (comment)
bdb1258
@retronym
The Scala Programming Language member

I've submitted a PR to revert the last commit here: https://github.com/scala/scala/pull/3732/files

@som-snytt

OK, shall I submit the corrected commit against master or 2.11? I didn't notice it was merged...

@retronym
The Scala Programming Language member

I just submitted a reversion against master. That will be merged to 2.11.x in an hour or two. You should target the re-refinement against 2.11.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment