-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Parsing indentation cleanup #10861
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
Parsing indentation cleanup #10861
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,10 @@ object Test: | |
y * y | ||
} | ||
|
||
val gg = (x: Int) ?=> | ||
val y = x + 1 | ||
y | ||
|
||
xs.map { | ||
x => | ||
val y = x * x | ||
|
@@ -80,11 +84,15 @@ object Test: | |
|
||
class Test2: | ||
self => | ||
def foo = 1 | ||
def foo(x: Int) = | ||
if x < 0 then throw | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really want to allow this? I somehow parse this as: if x < 0 then { throw();
val ex = ...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency I think it is better to allow it. The given expression abuses indentation rules for sure. It should be formatted like this:
|
||
val ex = new AssertionError() | ||
ex | ||
x | ||
|
||
val x = | ||
new Test2 { | ||
override def foo = 2 | ||
override def foo(x: Int) = 2 | ||
} | ||
end x | ||
end Test2 | ||
|
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.
should this comment be updated? Is this comment a pseudo grammar? Just from the comment it is not clear which "with" is a keyword and whether "," is a token or an informal alternative.