Skip to content

Incorrect error range in mixed lists with yield! #15361

@Lanayx

Description

@Lanayx

This issue is particularly painful when writing Fable UI where lists are often generated from data sequences using yield!

Repro steps

Provide the steps required to reproduce the problem:
Here is the code:

module Test =
    let f (): int list =
        [
            1
            "wrong"
            2
            yield! [3; 4]
        ]

Expected behavior

I expect the error to be highlighted only on "wrong" like when there is no yield!

image

Actual behavior

Whole list is highlighted with red

image

Provide a description of the actual behaviour observed.

Known workarounds

Not applicable

Related information

Provide any related information (optional):

dotnet 7.0.200

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions