-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unexpected behavior with indentation #9790
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
Comments
I believe this is all as expected and specified. Surprising? Maybe, but it can be explained by the stated rules.
(that's the second |
But couldn't we flag as an error the fact that it's indented less than the if it's part of? |
Or at least a warning. With |
Sorry for getting back to it, but after thinking about it further. When it comes to: object A:
def fn: Unit =
if true then
println(1)
else
println(2) The rule states:
So outdent for function fn should be added before We are having some issues with https://github.com/scalameta/scalameta/pull/2104/files so any additional information would be useful. |
Fix #9790: Update indentation spec to match observed behavior
Minimized code
A sample like this compiles fine:
but this one does not:
This is most likely due to one being a single statement and the other one is treated as a block, but this is a bit of an incoherent behavior and could lead to hard to spot errors.
Expectation
Then should require a proper increasing indentation and both examples should fail.
The text was updated successfully, but these errors were encountered: