-
Notifications
You must be signed in to change notification settings - Fork 823
Allow typed bindings(and!) in CE without parentheses #18682
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
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
and!
typed bindings…sharp into allow-and-bang-typed-bindings
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.
@edgarfgp Thanks for this! Could you also cover error cases in the grammar, please? If unified with the let
parsing, we could probably get a lot of recovery for free as well.
@@ -4107,6 +4107,22 @@ moreBinders: | |||
let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = Some mIn } | |||
SynExprAndBang(spBind, $1, true, $2, $4, m, trivia) :: $6 } | |||
|
|||
| AND_BANG headBindingPattern opt_topReturnTypeWithTypeConstraints EQUALS typedSequentialExprBlock IN moreBinders %prec expr_let |
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.
At this point we should probably try to unify let
and let!
parsing rules and check whether it's a !
version or not in the type checker. As the first step it should be at least parse it in a unified manner and then create different tree nodes conditionally. But ideally it should be something like isComputed: bool
flag that the type checker would inspect.
@edgarfgp Do you think it's feasible to unify the rules as part of this PR?
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 you think it's feasible to unify the rules as part of this PR?
Agreed. I think as part of this PR I can try and I can try and unify the parsing rules for let
, let!
and and!
.
Could you also cover error cases in the grammar, please?
Yeah I can add syntax tree test that show the parsing errors.
cc @T-Gro any objections ?
Description
Allow computation expression (CE) bindings (
let!
,use!
,and!
) to accept type annotations without requiring parentheses.Continuation of #18508
Implements RFC FS-1329: fsharp/fslang-design#802
Checklist