diff --git a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/MemberConstraints.fs b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/MemberConstraints.fs index 5f424466c2f..9e04bc75dfc 100644 --- a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/MemberConstraints.fs +++ b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/MemberConstraints.fs @@ -150,6 +150,23 @@ type UnionOfUnions<'T> = |> typecheck |> shouldSucceed + // https://github.com/dotnet/fsharp/issues/9878 + [] + let ``Issue 9878 - SRTP with phantom type parameter should compile`` () = + FSharp + """ +type DuCaseName<'T> = + static member ToCaseName<'t, 'u>(value: 't) = failwith "delayed resolution" + static member ToCaseName(value: 'T) = + match FSharp.Reflection.FSharpValue.GetUnionFields(value, typeof<'T>) with case, _ -> case.Name + static member inline Invoke(value: 'a) = + let inline call (other: ^M, value: ^I) = ((^M or ^I) : (static member ToCaseName: ^I -> string) value) + call (Unchecked.defaultof>, value) + """ + |> asLibrary + |> typecheck + |> shouldSucceed + // https://github.com/dotnet/fsharp/issues/9382 [] let ``Issue 9382 - SRTP stress test with matrix inverse should compile`` () =