Skip to content

SI-9246 *OrElse should have a by-name parameter#4285

Closed
193s wants to merge 1 commit intoscala:2.12.xfrom
193s:topic/prop2
Closed

SI-9246 *OrElse should have a by-name parameter#4285
193s wants to merge 1 commit intoscala:2.12.xfrom
193s:topic/prop2

Conversation

@193s
Copy link
Contributor

@193s 193s commented Feb 2, 2015

reopen #4279 💎
Sorry for the trouble.

@adriaanm
Copy link
Contributor

adriaanm commented Feb 2, 2015

No worries, @193s! Thank you for your contribution. It looks like the publish-core task discovered an issue with this submission:

Compiling 314 files to /home/jenkins/workspace/scala-2.11.x-validate-publish-core/build/locker/classes/compiler
/home/jenkins/workspace/scala-2.11.x-validate-publish-core/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala:616: warning: matches with two cases or fewer are emitted using if-then-else instead of switch
              (argsSize : @switch) match {
                           ^
/home/jenkins/workspace/scala-2.11.x-validate-publish-core/src/compiler/scala/tools/reflect/WrappedProperties.scala:23: error: method propOrElse overrides nothing.
Note: the super classes of trait WrappedProperties contain the following, non final members named propOrElse:
def propOrElse(name: String,alt: => String): String
  override def propOrElse(name: String, alt: String) = wrap(super.propOrElse(name, alt)) getOrElse alt
               ^
/home/jenkins/workspace/scala-2.11.x-validate-publish-core/src/compiler/scala/tools/reflect/WrappedProperties.scala:26: error: method envOrElse overrides nothing.
Note: the super classes of trait WrappedProperties contain the following, non final members named envOrElse:
def envOrElse(name: String,alt: => String): String
  override def envOrElse(name: String, alt: String)  = wrap(super.envOrElse(name, alt)) getOrElse alt
               ^
one warning found
two errors found

193s added a commit to 193s/scala that referenced this pull request Feb 3, 2015
@193s
Copy link
Contributor Author

193s commented Feb 3, 2015

I fixed! Thank you, @adriaanm!

BUILD SUCCESSFUL
Total time: 11 minutes 32 seconds

@adriaanm
Copy link
Contributor

adriaanm commented Feb 3, 2015

Great! You may ignore the IDE failure (#4287 has been merged to ignore it). The test failure is because this PR introduces a binary incompatible change in an API used by partest, which is compiled separately: scala/scala-partest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I suggested this before, but for completeness, convert all the API that correspond to Option, including envOrSome. And scalaPropOrElse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't noticed scalaPropOrElse, thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed; 193s@682fa11

193s added a commit to 193s/scala that referenced this pull request Feb 3, 2015
@som-snytt
Copy link
Contributor

Interestingly, test/files/run/t7775.scala relies on the eager behavior for the test to test anything. (Though I didn't test that.)

I wonder if a test rig could have the feature that it can demonstrate that it is still testing something.

A proof that the predicate being asserted is still meaningful after all these years.

edit (by lrytz): the test is extended in #4372

@lrytz
Copy link
Member

lrytz commented Mar 23, 2015

@adriaanm any ideas how we could push the change through (see your earlier comment)? i don't see a good way to keep the old signatures in the bytecode.

we could add overloads

propOrElse(name: String, alt: => String)
propOrElse(name: String, alt: String)

but then the compiler would pick the strict version, so the change would be pointless.

See #4297 for a similar problem.

@193s could you squash the three commits into one? (on your branch, run git rebase -i 70f960cfd1, then git push -f).

193s added a commit to 193s/scala that referenced this pull request Mar 24, 2015
fix scala#4285 compile error;

integrate pr scala#4285
@193s
Copy link
Contributor Author

193s commented Mar 24, 2015

@lrytz I did as you said, thanks!

@adriaanm
Copy link
Contributor

I think we can consider it a bug that the old *OrElse methods were eager, so we should fix that in 2.12. It seems unlikely that someone would expect eagerness here, or that these methods would be used in a performance hot spot. Let's add a deprecation message in 2.11 that says these methods will become call by name. The commit message of this PR should also explain why we made the change.

@lrytz
Copy link
Member

lrytz commented Mar 24, 2015

@adriaanm agreed, but my question was about the testing infrastructure: how can we get a green build, given that partest links against the old signature?

@193s thanks for the squash! as suggested by Adriaan, could you provide a bit more detail in the commit message? I created a ticket (https://issues.scala-lang.org/browse/SI-9246), so you can refer to that. See here for a lengthy description about commit messages: https://github.com/scala/scala/wiki/Pull-Request-Policy

The `*OrElse` methods in `scala.tools.reflect.WrappedProperties` and
`scala.util.Properties` should have a by-name parameter
@193s
Copy link
Contributor Author

193s commented Mar 24, 2015

@lrytz, @adriaanm Thanks for thanks for your kind advice.
I changed the commit message (e50fc2c), will that be ok?

@lrytz
Copy link
Member

lrytz commented Mar 24, 2015

@193s looks good, thanks! Now you just have to be patient until we figure out how to get our test infrastructure working.

@lrytz lrytz changed the title [reopen 2] make .*OrElse call-by-name SI-9246 *OrElse should have a by-name parameter Mar 24, 2015
@adriaanm
Copy link
Contributor

We'll have to release a new version of partest that uses reflection for one minor release I guess. Or that doesn't use the methods that break bin compat.

@som-snytt
Copy link
Contributor

I bet no one would notice if you sucked the partest module back into scala during lunch hour today. There wouldn't be even the slightest dip in the community contribution rate, either.

@adriaanm
Copy link
Contributor

True, but I'd rather not eat lunch than re-ingest that module. Completely agreed the partest burden should not be on the contributor, though.

adriaanm added a commit to adriaanm/scala-partest that referenced this pull request Mar 30, 2015
adriaanm added a commit to adriaanm/scala-partest that referenced this pull request Mar 30, 2015
adriaanm added a commit to adriaanm/scala that referenced this pull request Mar 31, 2015
@adriaanm
Copy link
Contributor

Hi, once #4419 is merged, please git rebase -i 2.11.x and git push --force 193s topic/prop2:topic/prop2. This should allow this PR to go green, since partest no longer uses the *OrElse methods.

retronym added a commit that referenced this pull request Apr 2, 2015
@adriaanm
Copy link
Contributor

adriaanm commented Apr 2, 2015

I've opened a new PR that does the rebase. I'll close this one. Thanks again for your contribution & patience ;-)

@adriaanm adriaanm closed this Apr 2, 2015
@adriaanm adriaanm added the 2.12 label Oct 29, 2016
lrytz pushed a commit to lrytz/scala-partest that referenced this pull request May 9, 2018
lrytz pushed a commit to lrytz/scala-partest that referenced this pull request May 9, 2018
lrytz pushed a commit to lrytz/scala that referenced this pull request May 9, 2018
lrytz pushed a commit to lrytz/scala that referenced this pull request May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants