-
Couldn't load subscription status.
- Fork 833
Description
Is your feature request related to a problem? Please describe.
Currently when implementing Combine and Delay CE members the error reporting uses the the complete ranges of all the expressions involved. e.g.
Describe the solution you'd like
Instead of using the complete range, we should be using the ranges of the expressions after the first one as this are the expressions that we are trying to Combine
type ListBuilder() =
member this.Yield(x) = [x]
member this.For(m,f) =
m |> List.collect f
member this.Combine (a,b) =
List.concat [a;b]
// member this.Delay(f) = f()
let listBuilder = new ListBuilder()
let result = listBuilder {
let a = 10
yield a
if true then
^^^^^^^^^^^^
yield 20
^^^^^^^^
else
^^^^
yield 30
^^^^^^^^
} Alternatively we can only uses the range for the places where we are actually using return or yield. For this we will need to use error recovery errorR but that might show errors hidden on purpose due to unhandled cases in the following phases.
type ListBuilder() =
member this.Yield(x) = [x]
member this.For(m,f) =
m |> List.collect f
member this.Combine (a,b) =
List.concat [a;b]
// member this.Delay(f) = f()
let listBuilder = new ListBuilder()
let result = listBuilder {
let a = 10
yield a
if true then
yield 20
^^^^^
else
yield 30
^^^^^
}Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
If the issue is about:
- improving a compiler error message, please mention "related:
TrackingError reporting improvements #1103" - improving/adjusting the parser, please mention "related:
Trackingmeta issue: parser related changes #11481"
Add any other context or screenshots about the feature request here.
Metadata
Metadata
Assignees
Type
Projects
Status