Prepare to make postfixOps syntax an error (not just a warning) unless the feature is explicitly enabled#6559
Conversation
|
After fixing gratuitous postfix in the compiler: Maybe @dwijnand knows if it's possible to set the scalac options for this compilation. It's ironic that the compatibility layer uses an incompatible feature. |
0fe03f2 to
6d49689
Compare
Nope, it's not configurable: https://github.com/sbt/zinc/blob/v1.1.5/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/AnalyzingCompiler.scala#L350
Hardly fair: you're using the legacy 0.13 version of sbt. Not a problem in sbt 1: sbt/zinc@ecf121a#diff-569dc93f697b5a143e904e517b998e1dL124. |
|
Thanks for checking, @dwijnand I think the irony is still apt, since that class is for 2.9-2.11 compatibility but doesn't negotiate SIP 18; but it wouldn't be fair to stretch the point. I'm not sure if scalac will upgrade to 1.1.x soon or if needing a 0.13.18 for 2.13 would be OK. |
more reason to land #6256
quite probably not |
Even if scalac migrates to sbt 1.1.x, IIUC this change would still break users builds using sbt 0.13.x with Scala 2.13.0-M4+. |
|
Yes, but if 0.13.18 is fixed, users can upgrade without much burden. I'll look into whether a special dispensation is possible for sbt, which wouldn't be the first time. |
c3ae8a4 to
e1d5208
Compare
adriaanm
left a comment
There was a problem hiding this comment.
I support this conceptually, but would like to structure the implementation differently.
- first commit should just flip the bit on enableRequired
- dispensation for sbt should go earlier in the pipeline, so we hit that path check only once
- Ignore new warning in code base || Welcome to rebase central!
| def hasOption = settings.language contains featureName | ||
| val OK = hasImport || hasOption | ||
| if (!OK) { | ||
| def dispensation = context.unit.source.file.path.endsWith("xsbt/Compat.scala") |
There was a problem hiding this comment.
I'm worried about doing this during type checking. I would be more comfortable with enabling the postfix ops feature from the start when creating a compiler run for this file.
There was a problem hiding this comment.
Roger. Or you might say, "Rojair."
e1d5208 to
3412fe3
Compare
|
It works with local bootstrap, but no one has complained that feature warning can double-report because the explanatory part fools the reporter. ( |
Usages unguarded by language import. In the same neighborhood, reduce infix as well.
3412fe3 to
d91f4a4
Compare
|
Golden tickets need to be handed out before checking them more vigorously: the sbt opt-out commit should go before the "more opt-in" commit. Also please split commits into boyscouting and strictly core changes, especially when we're flipping bits. Finally, kill your darlings, as William said (Faulkner, not the man in black): "Make postFixOps more opt-in" is a bit too clever. |
|
This is branch order, but github shows date order. Maybe I broke something. The bit is flipped in its own commit, or do you mean you'd like the required test fixes to precede it? Edit: reminder, don't forget to change title back to |
|
Ah, right! GH using date order is really unfortunate. Scabot just blindly follows it. I assume there's a rebase option to fix this? For the boy scouting, I was referring to the boolean algebra wizardry in the bit flip commit. It's not a big deal, but in general it's just nicer for reviewing to separate behavior changes from cleanups. Both are appreciated, just better separate. |
|
Note to self: t5675 is what rang a bell for the double-count issue for |
I think it's possible to fix this with |
If compiling exactly one file with a path ending in `xsbt/Compat.scala`, enable postfix ops. This avoids an error when sbt auto-compiles that file, after postfixOps feature is required. This commit does not attempt a general mechanism for adding hacks or hooks for special cases.
|
at https://contributors.scala-lang.org/t/lets-drop-postfix-operators/1457/11?u=sethtisue @LPTK expressed skepticism about the desirability of actually removing this in 2.14. I think the other changes in this PR take care of disarming the footgun. so maybe the actual removal under |
|
note also @sjrd's remarks at https://contributors.scala-lang.org/t/lets-drop-postfix-operators/1457/2?u=sethtisue, which @LPTK echoed |
|
one more thought: I think the error message should be more explicit that this "feature" is actually highly undesirable, likely to be removed in a future Scala, and is still supported at all only for backward compatibility and for no other reason. this isn't a "proceed, but with caution" type thing anymore like |
|
@SethTisue Please take a look at the doc change in the last commit. |
Use stronger language to dissuade from postfix, and make the descriptions more uniform. Distinguish required and convenience flags in docs.
0002c19 to
4d025a7
Compare
|
@adriaanm Moved the post-starr commit to the linked PR, in case that's the right thing to do. |
LGTM except that I'd suggest appending " (not recommended)" here + * - [[postfixOps `postfixOps`]] enables postfix operator notation |
|
OK, I'll add |
|
the |
|
@adriaanm @SethTisue if we can move this along, I'll have time to help with community build issues. I feel no special animus toward postfix, but hoping for clarity. It needs restarr for the other PR to put the nail in the coffin. |
|
does this PR actually make it an error? I'm not seeing that it does: |
|
oh, is that because "we'll have to release a new starr"? if so, then 1) can you update the PR title, and 2) yes, let's merge this. |
|
Yes, #6831 |
|
postfix ops are looking really nervous now |
|
Cool~ |
Require postfixOps opt-in instead of just warning.
Fixes scala/scala-dev#462