-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent results with function arguments and significant indentation #18345
Comments
I don't have a firm grip on the indentation syntax for method closures. Can someone else triage this? |
All examples compile on current nightly on my system. |
Closes scala#18345
For reference, I suspect there might still be something going on here. Here's a gist with all examples ready for scala-cli: https://gist.github.com/JD557/2c7e4817660da73e7eaaca0228e8df42 I can still reproduce the first problem in nightly with Surprisingly, I cannot reproduce the problems from examples 2 and 3 with scala-cli (either with nightly or with the current version). However, the problems still appear on Scastie, even on 3.3.1-RC1 (example 2, example 3). Maybe the way scala-cli and scastie are converting scripts in a different way (e.g. wrapping it in an |
The first example is not supposed to work. The others should work. |
Backports #18349 to the LTS branch. PR submitted by the release tooling. [skip ci]
Compiler version
3.3.0
Minimized code
Assuming the following definitions:
This code works fine with the old style:
But converting it to significant indentation fails with cryptic problems
Output
Example 1
Fails with
Example 2
Fails with
indented definitions expected, _ found
Example 3
Fails with
Recursive value $t needs type
Example 4
Surprisingly, the last two examples work fine when stored in a variable
Expectation
I would expect at least examples 2 and 3 to behave the same when stored in a variable or not.
I would also argue that all examples should compile, although maybe I'm missing some precedence rules that would make some of them ambiguous.
The text was updated successfully, but these errors were encountered: