Skip to content

Commit 632f970

Browse files
authored
Use errorR intead of try with and use range helpers (#15797)
1 parent db68a6c commit 632f970

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Compiler/Checking/CheckExpressions.fs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7418,15 +7418,12 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, m
74187418
| Some item ->
74197419
CallNameResolutionSink cenv.tcSink (fldId.idRange, env.eNameResEnv, item, emptyTyparInst, ItemOccurence.UseInType, env.eAccessRights)
74207420
| None -> ()
7421-
7422-
try
7423-
let firstPartRange = mkRange mWholeExpr.FileName mWholeExpr.Start (mkPos mWholeExpr.StartLine (mWholeExpr.StartColumn + 1))
7424-
// Use the left { in the expression
7425-
error(Error(FSComp.SR.chkCopyUpdateSyntaxInAnonRecords(), firstPartRange))
7426-
with _ ->
7427-
// Use the right } in the expression
7428-
let lastPartRange = mkRange mWholeExpr.FileName (mkPos mWholeExpr.StartLine (mWholeExpr.EndColumn - 1)) (mkPos mWholeExpr.StartLine (mWholeExpr.EndColumn))
7429-
error(Error(FSComp.SR.chkCopyUpdateSyntaxInAnonRecords(), lastPartRange))
7421+
let firstPartRange = withStartEnd mWholeExpr.Start (mkPos mWholeExpr.StartLine (mWholeExpr.StartColumn + 1)) mWholeExpr
7422+
// Use the left { in the expression
7423+
errorR(Error(FSComp.SR.chkCopyUpdateSyntaxInAnonRecords(), firstPartRange))
7424+
// Use the right } in the expression
7425+
let lastPartRange = withStartEnd (mkPos mWholeExpr.StartLine (mWholeExpr.EndColumn - 1)) (mkPos mWholeExpr.StartLine mWholeExpr.EndColumn) mWholeExpr
7426+
errorR(Error(FSComp.SR.chkCopyUpdateSyntaxInAnonRecords(), lastPartRange))
74307427
[]
74317428
else
74327429
// If the overall type is a record type build a map of the fields

0 commit comments

Comments
 (0)