Skip to content

Commit 6856d2c

Browse files
committed
perform sourceExpr translation on match-bang expressions (#9407)
* perform sourceExpr translation on match-bang expressions * add test for match-bang source translations
1 parent 2e766b5 commit 6856d2c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/fsharp/TypeChecker.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8570,6 +8570,7 @@ and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builder
85708570

85718571
// 'match! expr with pats ...' --> build.Bind(e1, (function pats ...))
85728572
| SynExpr.MatchBang (spMatch, expr, clauses, m) ->
8573+
let matchExpr = mkSourceExpr expr
85738574
let mMatch = match spMatch with DebugPointAtBinding mMatch -> mMatch | _ -> m
85748575
if isQuery then error(Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery(), mMatch))
85758576

@@ -8580,7 +8581,7 @@ and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builder
85808581
let consumeExpr = SynExpr.MatchLambda (false, mMatch, clauses, spMatch, mMatch)
85818582

85828583
// TODO: consider allowing translation to BindReturn
8583-
Some(translatedCtxt (mkSynCall "Bind" mMatch [expr; consumeExpr]))
8584+
Some(translatedCtxt (mkSynCall "Bind" mMatch [matchExpr; consumeExpr]))
85848585

85858586
| SynExpr.TryWith (innerComp, _mTryToWith, clauses, _mWithToLast, mTryToLast, spTry, _spWith) ->
85868587
let mTry = match spTry with DebugPointAtTry.Yes m -> m | _ -> mTryToLast

0 commit comments

Comments
 (0)