Uh oh!
There was an error while loading. Please reload this page.
Parens: more comprehensive pattern tests - #16313
Conversation
psfinaki
commented
Nov 21, 2023
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
psfinaki
commented
Nov 21, 2023
/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 |
psfinaki
commented
Nov 22, 2023
@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 patternstests atomic or nullary patterns nested one level deep inside of all non-nullary patterns (patterns in which other patterns can be nested).Deeply nested patternstests all non-atomic, non-nullary patterns nested inside of all non-nullary patterns.Miscellaneous patternstests some of the compiler oddities I found.SynPatcontexts, among which there are slight differences in when parens are required:SynBinding,SynMatchClause,SynExpr.LetOrUse,SynExpr.LetOrUseBang,SynExpr.Lambda.Examples