Skip to content

Compile generic extension forwarding without optimization #20685

Closed

Description

@T-Gro

Repro steps

Program.fs:

type Dispatch = Value with static member Get Value = 1
module Extensions =
    type Dispatch with
        static member inline Call(x: ^T) = (^T : (static member Get: ^T -> int) x)
        static member inline Invoke(x: ^T) = ((^T or Dispatch) : (static member Call: ^T -> int) x)
open Extensions
let result = Dispatch.Invoke Value
dotnet $fsc --targetprofile:netcore --langversion:preview --optimize- Program.fs

Expected behavior

Compiles; result = 1.

Actual behavior

FS0193: A type parameter is missing a constraint 'when ^T: (static member Get: ^T -> Microsoft.FSharp.Core.int)'

Known workarounds

--optimize+

Related information

Reproduced on fresh main.

Activity

  1. added this to the Backlog milestone on Oct 1, 2026
  2. added a commit that references this issue on Oct 9, 2026
    6cde2b1
  3. added a commit that references this issue on Oct 15, 2026
    2d505d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions