Skip to content
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* Symbols: Add FSharpAssembly.IsFSharp ([PR #18290](https://github.com/dotnet/fsharp/pull/18290))
* Type parameter constraint `null` in generic code will now automatically imply `not struct` ([Issue #18320](https://github.com/dotnet/fsharp/issues/18320), [PR #18323](https://github.com/dotnet/fsharp/pull/18323))
* Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341)
* Use a more accurate range for CE Combine methods. [PR #18394](https://github.com/dotnet/fsharp/pull/18394)


### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,12 @@ let rec TryTranslateComputationExpression
// "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1)
let m1 = rangeForCombine innerComp1

let combineDelayRange =
match innerComp2 with
| SynExpr.YieldOrReturn(trivia = yieldOrReturn) -> yieldOrReturn.YieldOrReturnKeyword
| SynExpr.YieldOrReturnFrom(trivia = yieldOrReturnFrom) -> yieldOrReturnFrom.YieldOrReturnFromKeyword
| expr -> expr.Range

if
isNil (
TryFindIntrinsicOrExtensionMethInfo
Expand All @@ -1624,7 +1630,8 @@ let rec TryTranslateComputationExpression
ceenv.builderTy
)
then
error (Error(FSComp.SR.tcRequireBuilderMethod ("Combine"), m))

error (Error(FSComp.SR.tcRequireBuilderMethod "Combine", combineDelayRange))

if
isNil (
Expand All @@ -1638,7 +1645,7 @@ let rec TryTranslateComputationExpression
ceenv.builderTy
)
then
error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), m))
error (Error(FSComp.SR.tcRequireBuilderMethod "Delay", combineDelayRange))

let combineCall =
mkSynCall
Expand Down
Loading