Weird action at a distance beyond parentheses #17791
Replies: 2 comments
-
|
With this code (I tried to get something different from "end of toplevel definition expected"): the message (or two, actually) is longer and appears to treat the result of And if I change parentheses to braces: it's: |
Beta Was this translation helpful? Give feedback.
-
|
TIL The spec for application says "if f has some value type", without reference to syntax. I remember Scala 2's OK, I see the syntax diff in Scala 2 is but args follow a (In a different context, I saw Scala 3 doesn't have SimpleExpr1, so I don't know without experimenting how this changes in Scala 3.) (Sorry I don't remember that different context where I wondered recently how do they get by without a SimpleExpr1 production.) The other syntax worth mentioning is but the user wants better feedback on the implicit param list, which is effectively concealed. Edit: on wrapping a simpleexpr1 in parens, hoping it becomes |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I can't do
Seq(0).sortBy(_.abs)(0). That's understandable – the(0)isn't understood as indexing but a second parameter list (implicit) forsortBy, expected to contain a value of typeOrdering[Int]. The common remedy is to explicitly reach forapply, thus:Seq(0).sortBy(_.abs) apply 0. I thought I could guide the compiler to get my intention with a pair of parentheses:(Seq(0).sortBy(_.abs))(0). But no – it gives the same error message as without. What helps is({Seq(0).sortBy(_.abs)})(0).Additionally, rejection of
{Seq(0).sortBy(_.abs)}(0)as invalid syntax also seems a wart. And the message in this case is perplexing both in worksheet mode:and in normal mode:
Beta Was this translation helpful? Give feedback.
All reactions