Registry Mirror
Skip to content

Invalid error range for special cases of NoEquality types #15518

Open

Description

@psfinaki

Repro steps

This code:

[<NoEquality; NoComparison; Struct>]
type MyType(field: string) =
    member _.Field = field

module internal MyTypeHelpers =

    let f (myType: MyType) =
        42

    let g myType =
        let x = myType
        let y = myType
        let z = x = y
        f myType

Expected behavior

An error on the line let z = x = y

Actual behavior

Error on the last line:
image

Related information

Any of the below fixes the case:

  1. Removing explicit type in the first helper - that the first helper infers input as a general type and the second helper infer input as something with equality
  2. Adding explicit type to the second helper - just works as expected
    image

Also, note that the error message mentioned the correct range.

Activity

  1. added this to the Backlog milestone on Jun 28, 2023
  2. added
    Impact-Medium
    Area-LangService-Diagnostics
    and removed on Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LangService-DiagnosticsBugImpact-Medium

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions