Skip to content

[generics/error message] ?typeid shown in error message for missing type constraint #6725

Description

@smoothdeveloper

This code exposes internally generated type identifiers in error messages:

Repro steps

type C() =
    static member M<'a,'b>(a: 'a, b: 'b) = a + b

Expected behavior

A type parameter is missing a constraint 'when ( ^a or ^b) : (static member ( + ) : ^a * ^b -> ^c) ...'

Actual behavior

A type parameter is missing a constraint 'when ( ^a or ^b) : (static member ( + ) : ^a * ^b -> ^?8018)'

image

image

Related information

vs 2019 16.0.3
ionide 3.37.0

Activity

  1. added this to the Backlog milestone on May 14, 2019
  2. cartermp commented on May 14, 2019

    @cartermp
    Contributor

    Labeling as a bug due to not wanting to leak the type ID here. The missing constraint is correct though.

  3. smoothdeveloper commented on May 16, 2019

    @smoothdeveloper
    ContributorAuthor

    probable location of the bug, or the callsite which gives some display settings as input parameter:

    and layoutConstraintsWithInfo denv env cxs =
    // Internally member constraints get attached to each type variable in their support.
    // This means we get too many constraints being printed.
    // So we normalize the constraints to eliminate duplicate member constraints
    let cxs =
    cxs
    |> ListSet.setify (fun (_, cx1) (_, cx2) ->
    match cx1, cx2 with
    | TyparConstraint.MayResolveMember(traitInfo1, _),
    TyparConstraint.MayResolveMember(traitInfo2, _) -> traitsAEquiv denv.g TypeEquivEnv.Empty traitInfo1 traitInfo2
    | _ -> false)
    let cxsL = List.collect (layoutConstraintWithInfo denv env) cxs
    match cxsL with
    | [] -> emptyL
    | _ ->
    if denv.abbreviateAdditionalConstraints then
    wordL (tagKeyword "when") ^^ wordL(tagText "<constraints>")
    elif denv.shortConstraints then
    leftL (tagPunctuation "(") ^^ wordL (tagKeyword "requires") ^^ sepListL (wordL (tagKeyword "and")) cxsL ^^ rightL (tagPunctuation ")")
    else
    wordL (tagKeyword "when") ^^ sepListL (wordL (tagKeyword "and")) cxsL

  4. added
    Impact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
    on Aug 31, 2020
  5. dsyme commented on Nov 5, 2021

    @dsyme
    Contributor

    Duplicate of #385

  6. abelbraaksma commented on May 16, 2024

    @abelbraaksma
    Contributor

    This was closed as duplicate, but the resolution of the duplicate did not resolve this one. Reopening, as the typeid-error is still there:
    image

    Related: #3508

  7. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    Verified that the underlying diagnostic bug still reproduces at repo HEAD 8512f9acbd9f757b75440b1ca6afe33fec321208 (commit dated 2026-10-02, about 13 hours old at the start of this run).

    The freshly built FSI reports version 15.2.200.0 for F# 11.2, FSharp.Core 11.0.0.0, on .NET 11.0.0-rc.1.26420.103.

    For the original static member M<'a, 'b>(a: 'a, b: 'b) = a + b repro, the current compiler no longer prints a numbered identifier such as ^?8018, but it still exposes an unresolved placeholder in the public diagnostic:

    error FS0043: A type parameter is missing a constraint 'when (^a or ^b) : (static member (+) : ^a * ^b -> '``?``)'
    

    So the numeric suffix has disappeared, but the result type is still rendered as the internal-looking `'``?``` rather than a meaningful type variable.

    Warning

    Firewall blocked 1 domain

    The following domain was blocked by the firewall during workflow execution:

    • southcentralus0.in.applicationinsights.azure.com

    To allow these domains, add them to the network.allowed list in your workflow frontmatter:

    network:
      allowed:
        - defaults
        - "southcentralus0.in.applicationinsights.azure.com"

    See Network Configuration for more information.

    Generated by 🌈 Repo Assist, see workflow run. Learn more.

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@7c7feb61a52b662eb2089aa2945588b7a200d404
    
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

    BugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions