Skip to content

Commit f960746

Browse files
committed
Update CheckComputationExpressions.fs
1 parent b3db637 commit f960746

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/Compiler/Checking/Expressions/CheckComputationExpressions.fs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,8 @@ let (|ExprAsUseBang|_|) expr =
862862
body = innerComp
863863
trivia = { LetOrUseKeyword = mBind }) ->
864864
match bindings with
865-
| SynBinding(debugPoint = spBind; headPat = pat; expr = rhsExpr) :: bindings ->
866-
ValueSome(spBind, isFromSource, pat, rhsExpr, bindings, innerComp, mBind)
865+
| SynBinding(debugPoint = spBind; headPat = pat; expr = rhsExpr) :: remainingBindings ->
866+
ValueSome(spBind, isFromSource, pat, rhsExpr, remainingBindings, innerComp, mBind)
867867
| _ -> ValueNone
868868

869869
| _ -> ValueNone
@@ -879,8 +879,8 @@ let (|ExprAsLetBang|_|) expr =
879879
body = innerComp
880880
trivia = { LetOrUseKeyword = mBind }) ->
881881
match bindings with
882-
| SynBinding(debugPoint = spBind; headPat = pat; expr = rhsExpr) :: bindings ->
883-
ValueSome(spBind, isFromSource, pat, rhsExpr, bindings, innerComp, mBind)
882+
| SynBinding(debugPoint = spBind; headPat = pat; expr = rhsExpr) :: andBangBindings ->
883+
ValueSome(spBind, isFromSource, pat, rhsExpr, andBangBindings, innerComp, mBind)
884884
| _ -> ValueNone
885885
| _ -> ValueNone
886886

@@ -1435,12 +1435,29 @@ let rec TryTranslateComputationExpression
14351435

14361436
SynExpr.LetOrUse(false, false, true, true, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero)
14371437

1438+
let firstBinding =
1439+
SynBinding(
1440+
accessibility = None,
1441+
kind = SynBindingKind.Normal,
1442+
isInline = false,
1443+
isMutable = false,
1444+
attributes = [],
1445+
xmlDoc = PreXmlDoc.Empty,
1446+
valData = SynInfo.emptySynValData,
1447+
headPat = patFirst,
1448+
returnInfo = None,
1449+
expr = guardExpr,
1450+
range = mGuard,
1451+
debugPoint = DebugPointAtBinding.NoneAtSticky,
1452+
trivia = SynBindingTrivia.Zero
1453+
)
1454+
14381455
SynExpr.LetOrUse(
14391456
false,
14401457
false, // Pass through the isUse flag from binding info
14411458
true, // isFromSource is true for user-written code
14421459
true, // isComputed is true for bang let/let!
1443-
[],
1460+
[ firstBinding ],
14441461
body,
14451462
mGuard,
14461463
SynExprLetOrUseTrivia.Zero

src/Compiler/SyntaxTree/ParseHelpers.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ let mkLetExpression
11231123
isUse, // Pass through the isUse flag from binding info
11241124
true, // isFromSource is true for user-written code
11251125
true, // isComputed is true for let!/use!
1126-
binding :: decls,
1126+
binding :: List.rev decls,
11271127
body,
11281128
mWhole,
11291129
trivia

0 commit comments

Comments
 (0)