-
Notifications
You must be signed in to change notification settings - Fork 833
Add "," as separator for pattern matching on multiple named discriminated unions fields #18833
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
Conversation
…ated unions fields
❗ Release notes required
|
tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs.fs
Outdated
Show resolved
Hide resolved
| | SyntaxNode.SynExpr(SynExpr.Record(None, _, fields, _)) :: _ -> | ||
| let isFirstField = | ||
| match field, fields with | ||
| | Some contextLid, SynExprRecordField(fieldName = lid, _) :: _ -> contextLid.Range = lid.Range |
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.
The existing pattern matching code seems incorrect - it was missing the tuple parentheses that should have been there. fieldName = lid, _ should have been fieldName = (lid, _).
| match recordFields with | ||
| | [] -> false | ||
| | SynExprRecordField(expr = Some(SynExpr.Paren(expr = Is inner)); blockSeparator = Some _) :: SynExprRecordField( | ||
| fieldName = SynLongIdent(id = id :: _), _) :: _ -> problematic inner.Range id.idRange |
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.
same here
Description
Implements fsharp/fslang-suggestions#957
Checklist