New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow infix operators at start of line (under -Xsource:3
only)
#8419
Conversation
Probably the reason the "simple expr token" test was not used for unary op parsing was this asymmetry:
Not sure it matters which token test is applied for multiline infix. It would be kind of nice for the multiline infix case to error the same as oneline, with "illegal start of simple". "This looks like infix except for the form of the arg." Even nicer would be to say, "Your expression is OK here, but you need a simple expression, so maybe try wrapping it in parens." Probably every error message should say: Did you try adding parens? |
Looks good, thanks! Leaving open for more 👀 |
864ac1d
to
4db40e4
Compare
Rebased. Maybe the release notes should include a page of "dotty preview" features. |
4db40e4
to
73a2152
Compare
@lrytz @SethTisue Who do I gotta bribe around here? This is significant enough (and yet incremental enough) to require community build vetting. |
I'll take a cup of coffee and an IRL chat: https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/3127/ See build parameters: https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/3127/parameters/ |
I just hope this isn't one of those mini-features that everyone likes in theory and hates in practice, like |
(I love me some -Xlint, I just need a little |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I re-started the community build (https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/3132), hopefully it gets a bit further this time.
Could you add a test for infix use of backticked methods? From doti
scala> class K { def x(y: Int) = 0 }
// defined class K
scala> def foo = {
| (new K)
| `x` 1
| }
def foo: Int
scala> def foo = {
| (new K)
| x 1
| }
3 | x 1
| ^
| end of statement expected but integer literal found
4 |}
|^
|';' expected, but '}' found
Hmm, the community build failed during extraction of
The last green run form Feb 2 (https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/3129) used the same revision of |
Probably here's the issue https://github.com/djspiewak/sbt-spiewak/blob/d4d4eeebfb27b7e7e1dc4878f56afb6c1b61ec6c/core/src/main/scala/sbtspiewak/FullScalaVersion.scala |
(cc @djspiewak) |
we don't have a fix from Daniel for that yet (as per djspiewak/sbt-spiewak#5) — I'll hack around it today |
Worth repeating TIL infixed backticked. |
73a2152
to
1b22680
Compare
cats-effects-testing thing was fixed; community build run got farther this time https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/3136/ there were a bunch of failures, I suppose because |
Backport from dotty under `-Xsource:2.14`. The simple expr token test was unused, and is moved to scanner. Partests are more verbose than in dotty.
1b22680
to
3ad1c39
Compare
Me too, by reading your code 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks @som-snytt! Community build output didn't show anything suspicious.
Is it too risky to enable it for 2.13? |
I only do |
I suggest we not try to get that into 2.13.2, but if we want to try for 2.13.3, a couple thoughts:
|
It could affect a certain coder who puts a space after unary op,
Oh, I guess it would affect someone who wrote a DSL to look like markdown list:
|
We did. Lukas said: "Community build output didn't show anything suspicious." |
(I don't think that run was complete enough to give good feedback, because enabling |
We could enable under |
-Xsource:3
only)
Original PR in compiler - scala/scala#8419 Fixes scalameta#2739.
Original PR in compiler - scala/scala#8419 Fixes scalameta#2739.
Original PR in compiler - scala/scala#8419 Fixes #2739.
Backport from dotty under
-Xsource:2.14
-Xsource:3
.The simple expr token test was unused, and is moved
to scanner. Partests are more verbose than in dotty.