-
Notifications
You must be signed in to change notification settings - Fork 853
Nested let! should compile #19457
Copy link
Copy link
Open
Labels
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)End-to-end experience for computation expressions (except async and state machine compilation)Bug
Milestone
Metadata
Metadata
Assignees
Labels
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)End-to-end experience for computation expressions (except async and state machine compilation)Bug
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
Status
New
A
let!nested in a simpleletbinding is currently not allowed by the compiler.Example:
The 4th line produces
error FS0750: This construct may only be used within computation expressions.(Except for SDK 10.0, where the
let!is silently compiled as a simplelet, see #19456.)I believe this behavior is a bug and the above example should compile correctly.
The spec, as quoted here, prescribes the following transformations:
{{ let binding in cexpr }}=>let binding in {{ cexpr }}and{{ let! pattern = expr in cexpr }}=>builder.Bind(expr, (fun pattern -> {{ cexpr }}))It seems that applying them to the example code is straightforward and should lead to correct compilation of the CE rather than to an error message.