-
Notifications
You must be signed in to change notification settings - Fork 789
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
Parens: more comprehensive pattern tests #16313
Conversation
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Thanks for extra tests! Well as long as the tests maintain structure, don't run too long and are not flaky, I am fine with that. I wonder if they can be somehow reorged like "common scenarios" vs "edge-case scenarios"? |
* This optimization could in theory be used for all tests in this project if we set up some kind of solution cache keyed by project & editor settings, but it looks like it would require some refactoring in RoslynTestHelpers.
@psfinaki I added some comments to the test code for clarity and updated the PR description. Let me know if you think there's anything else I should do to make things clearer. …Although I guess there are still some more places I could add comments—e.g., why a dangling typed expression is not allowed in a match clause (because the match clause's |
@brianrourkeboll I think this is good enough for now. We can always reassess the test structure in followups :) |
Another followup to #16079.
Let me know if you think this is overkill. It probably doesn't make sense to do the exact same thing for expressions (I would do that in a separate PR), since the number of tests would probably be massive, but I have half a mind to try something similar using FsCheck instead, even if it is not run on every commit.
The tests in this PR are grouped as follows:
Singly nested patterns
tests atomic or nullary patterns nested one level deep inside of all non-nullary patterns (patterns in which other patterns can be nested).Deeply nested patterns
tests all non-atomic, non-nullary patterns nested inside of all non-nullary patterns.Miscellaneous patterns
tests some of the compiler oddities I found.SynPat
contexts, among which there are slight differences in when parens are required:SynBinding
,SynMatchClause
,SynExpr.LetOrUse
,SynExpr.LetOrUseBang
,SynExpr.Lambda
.Examples