-
Notifications
You must be signed in to change notification settings - Fork 30
small layout corrections and small performance improvements #237
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
small layout corrections and small performance improvements #237
Conversation
|
Do you think you could write tests for the code samples where we were too lenient before this PR? I'd love for the test harness to catch that in the future. |
| } | ||
| ) | ||
| ) | ||
| -- yes, ( ) is a valid pattern but not a valid type or expression |
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.
Do we have a test for this?
I think we would ideally want one for all 3 situations (patterns, types and expressions)
|
Really nice! And the performance improvement is nothing to scoff at either! |
The implementation of
expressionoptimistically pads right (and left?). This is sometimes taken for granted, replacing layout, creating a too lenient parser.The "new" parser is now sometimes more strict (e.g. requiring
if elseto stay above current indent), and sometimes more lenient (e.g. allowingcase(x)of(Variant)->).I found these after converting the expression parser to a non-padding parser (which turned out to be slower so I never committed it but the corrections are still right).
In terms of performance, it's nothing much, the biggest change coming from an avoided
List.mapby switching fromNode Expression -> Parser (Node Expression)toParser (union type)for the pratt things.