@@ -95,7 +95,7 @@ let YieldFree (cenv: cenv) expr =
95
95
| SynExpr.Sequential (_, _, e1, e2, _) ->
96
96
YieldFree e1 && YieldFree e2
97
97
98
- | SynExpr.IfThenElse (_, e2 , e3opt, _, _, _, _) ->
98
+ | SynExpr.IfThenElse (_, _, _, _, e2 , _ , e3opt, _, _, _, _) ->
99
99
YieldFree e2 && Option.forall YieldFree e3opt
100
100
101
101
| SynExpr.TryWith ( e1, _, clauses, _, _, _, _) ->
@@ -126,7 +126,7 @@ let YieldFree (cenv: cenv) expr =
126
126
| SynExpr.Sequential (_, _, e1, e2, _) ->
127
127
YieldFree e1 && YieldFree e2
128
128
129
- | SynExpr.IfThenElse (_, e2 , e3opt, _, _, _, _) ->
129
+ | SynExpr.IfThenElse (_, _, _, _, e2 , _ , e3opt, _, _, _, _) ->
130
130
YieldFree e2 && Option.forall YieldFree e3opt
131
131
132
132
| SynExpr.TryWith ( e1, _, clauses, _, _, _, _) ->
@@ -707,7 +707,7 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
707
707
// NOTE: we should probably suppress these sequence points altogether
708
708
let rangeForCombine innerComp1 =
709
709
match innerComp1 with
710
- | SynExpr.IfThenElse (_, _, _, _, _, mIfToThen, _ m) -> mIfToThen
710
+ | SynExpr.IfThenElse (_, _, _, _, _, _, _, _, _, mIfToThen, _ m) -> mIfToThen
711
711
| SynExpr.Match ( DebugPointAtBinding.Yes mMatch, _, _, _) -> mMatch
712
712
| SynExpr.TryWith (_, _, _, _, _, DebugPointAtTry.Yes mTry, _) -> mTry
713
713
| SynExpr.TryFinally (_, _, _, DebugPointAtTry.Yes mTry, _) -> mTry
@@ -1071,17 +1071,17 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
1071
1071
SynExpr.Sequential( sp, true , innerComp1, holeFill, m)
1072
1072
translatedCtxt fillExpr))
1073
1073
1074
- | SynExpr.IfThenElse ( guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1074
+ | SynExpr.IfThenElse ( ifKw , isElif , guardExpr, thenKw , thenComp, elseKw , elseCompOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1075
1075
match elseCompOpt with
1076
1076
| Some elseComp ->
1077
1077
if isQuery then error( Error( FSComp.SR.tcIfThenElseMayNotBeUsedWithinQueries(), mIfToThen))
1078
- Some ( translatedCtxt ( SynExpr.IfThenElse ( guardExpr, transNoQueryOps thenComp, Some( transNoQueryOps elseComp), spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch)))
1078
+ Some ( translatedCtxt ( SynExpr.IfThenElse ( ifKw , isElif , guardExpr, thenKw , transNoQueryOps thenComp, elseKw , Some( transNoQueryOps elseComp), spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch)))
1079
1079
| None ->
1080
1080
let elseComp =
1081
1081
if isNil ( TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mIfToThen ad " Zero" builderTy) then
1082
1082
error( Error( FSComp.SR.tcRequireBuilderMethod( " Zero" ), mIfToThen))
1083
1083
mkSynCall " Zero" mIfToThen []
1084
- Some ( trans CompExprTranslationPass.Initial q varSpace thenComp ( fun holeFill -> translatedCtxt ( SynExpr.IfThenElse ( guardExpr, holeFill, Some elseComp, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch))))
1084
+ Some ( trans CompExprTranslationPass.Initial q varSpace thenComp ( fun holeFill -> translatedCtxt ( SynExpr.IfThenElse ( ifKw , isElif , guardExpr, thenKw , holeFill, None , Some elseComp, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch))))
1085
1085
1086
1086
// 'let binds in expr'
1087
1087
| SynExpr.LetOrUse ( isRec, false , binds, innerComp, m) ->
@@ -1543,7 +1543,7 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
1543
1543
else
1544
1544
None
1545
1545
1546
- | SynExpr.IfThenElse ( guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1546
+ | SynExpr.IfThenElse ( ifKw , isElif , guardExpr, thenKw , thenComp, elseKw , elseCompOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1547
1547
match convertSimpleReturnToExpr varSpace thenComp with
1548
1548
| None -> None
1549
1549
| Some (_, Some _) -> None
@@ -1558,7 +1558,7 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
1558
1558
| Some ( elseExpr, None) -> Some ( Some elseExpr)
1559
1559
match elseExprOptOpt with
1560
1560
| None -> None
1561
- | Some elseExprOpt -> Some ( SynExpr.IfThenElse ( guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch), None)
1561
+ | Some elseExprOpt -> Some ( SynExpr.IfThenElse ( ifKw , isElif , guardExpr, thenKw , thenExpr, elseKw , elseExprOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch), None)
1562
1562
1563
1563
| SynExpr.LetOrUse ( isRec, false , binds, innerComp, m) ->
1564
1564
match convertSimpleReturnToExpr varSpace innerComp with
@@ -1599,7 +1599,7 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
1599
1599
| OptionalSequential ( JoinOrGroupJoinOrZipClause _, _) -> false
1600
1600
| OptionalSequential ( CustomOperationClause _, _) -> false
1601
1601
| SynExpr.Sequential (_, _, innerComp1, innerComp2, _) -> isSimpleExpr innerComp1 && isSimpleExpr innerComp2
1602
- | SynExpr.IfThenElse (_, thenComp, elseCompOpt, _, _, _, _) ->
1602
+ | SynExpr.IfThenElse (_, _, _, _, thenComp, _ , elseCompOpt, _, _, _, _) ->
1603
1603
isSimpleExpr thenComp && ( match elseCompOpt with None -> true | Some c -> isSimpleExpr c)
1604
1604
| SynExpr.LetOrUse (_, _, _, innerComp, _) -> isSimpleExpr innerComp
1605
1605
| SynExpr.LetOrUseBang _ -> false
@@ -1615,7 +1615,7 @@ let TcComputationExpression cenv env overallTy tpenv (mWhole, interpExpr: Expr,
1615
1615
| _ -> true
1616
1616
1617
1617
let basicSynExpr =
1618
- trans CompExprTranslationPass.Initial ( hasCustomOperations ()) ( LazyWithContext.NotLazy ([], env)) comp ( fun holeFill -> holeFill )
1618
+ trans CompExprTranslationPass.Initial ( hasCustomOperations ()) ( LazyWithContext.NotLazy ([], env)) comp id
1619
1619
1620
1620
let delayedExpr =
1621
1621
match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad " Delay" builderTy with
@@ -1822,7 +1822,7 @@ let TcSequenceExpression (cenv: cenv) env tpenv comp overallTy m =
1822
1822
let innerExpr2 , tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp2
1823
1823
Some( Expr.Sequential( stmt1, innerExpr2, NormalSeq, sp, m), tpenv)
1824
1824
1825
- | SynExpr.IfThenElse ( guardExpr, thenComp, elseCompOpt, spIfToThen, _ isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1825
+ | SynExpr.IfThenElse (_, _, guardExpr, _, thenComp, _ , elseCompOpt, spIfToThen, _ isRecovery, mIfToThen, mIfToEndOfElseBranch) ->
1826
1826
let guardExpr ' , tpenv = TcExpr cenv cenv.g.bool_ ty env tpenv guardExpr
1827
1827
let thenExpr , tpenv = tcSequenceExprBody env genOuterTy tpenv thenComp
1828
1828
let elseComp = ( match elseCompOpt with Some c -> c | None -> SynExpr.ImplicitZero mIfToThen)
@@ -1837,7 +1837,7 @@ let TcSequenceExpression (cenv: cenv) env tpenv comp overallTy m =
1837
1837
tpenv
1838
1838
true
1839
1839
comp
1840
- ( fun x -> x ) |> Some
1840
+ id |> Some
1841
1841
1842
1842
// 'use x = expr in expr'
1843
1843
| SynExpr.LetOrUse (_ isRec, true , [ SynBinding (_ vis, SynBindingKind.Normal, _, _, _, _, _, pat, _, rhsExpr, _, spBind)], innerComp, wholeExprMark) ->
0 commit comments