Skip to content

No intellisense error or meaningful errormessage on Seq.iter build error. #17651

@AndersBreg

Description

@AndersBreg

Please provide a succinct description of the issue.

Repro steps

Provide the steps required to reproduce the problem:

  1. The following minimal sample doesn't get any errors from Intellisense analysis, but does not build, and with no meaningful error message.
[<EntryPoint>]
let main args =
    let doCalculation : string -> string list -> list<bool> = fun e r -> [true; false; true]
    let bestChoices =
        ["one"]
        |> Seq.map (fun context ->
            context,
            ["two"]
            |> List.ofSeq
            |> Seq.groupBy (fun choice ->
                [choice]
                |> doCalculation choice
                |> List.length
            )
            |> Seq.sortBy (fun (num, _) -> num)
        )
        |> Seq.map (fun (context, groupings) ->
            context, Seq.maxBy (fun (num, _) -> num) groupings
        )
    Seq.iter (fun (context, num, choices) ->
        List.iter (fun (num, buildings) ->
            Seq.iter (printf "%A, ") buildings
        ) choices
    ) bestChoices
    0

If possible attach a zip file with the repro case. This often makes it easier for others to reproduce.
The zip file should ideally represent the situation just before the call/step that is problematic.

Expected behavior

An intellisense message or a more detailed build error to indicate what the problem is.

Actual behavior

The build fails, with FS0001 error.

Known workarounds

Changing the outer Seq.iter to List.iter gives a correct error message both in intellisense and in the build errors.

Related information

  • Windows
  • .Net Core 8.0.100
  • Happens both in Visual Studio and on dotnet build

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions