Skip to content

Signature file generation does not handle WhereTyparSubtypeOfType #14706

@nojaf

Description

@nojaf

When generating a signature file from a static member with a subtype constraint, the result is somewhat unexpected.

Repro steps

module Foo

type IProvider =
    interface
    end

type Tainted<'T> =
    class
    end

type ConstructB =
    static member ComputeDefinitionLocationOfProvidedItem<'T when 'T :> IProvider>(p: Tainted<'T>) : obj option = None

leads to

module Foo

type IProvider =
  interface end

type Tainted<'T> =
  class end

type ConstructB =

  static member ComputeDefinitionLocationOfProvidedItem: p: Tainted<#IProvider> -> obj option

Expected behaviour

[<Class>] should be added to type ConstructB (otherwise it won't compile) and overall I was expecting:

[<Class>]
type ConstructB =
    static member ComputeDefinitionLocationOfProvidedItem<'T when 'T :> IProvider> : p: Tainted<'T> -> obj option

Actual behaviour

While the signature does compile, I do suspect it can lead to unexpected IL or influence the mvid in another way.

Related information

Detected via #14703

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CodeGenIlxGen, ilwrite and things at the backendBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.help wanted

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions