For an interface method with a byref<'t> return, it's not possible to provide an implementation that just throws an exception
Repro steps
open System
type Ii<'T> =
abstract GetSpan : int -> ReadOnlySpan<'T>
[<Struct>]
type X(value : int) =
interface Ii<int> with
member __.GetSpan n = ReadOnlySpan()
[<Struct>]
type Y(value : int) =
interface Ii<int> with
member __.GetSpan n = failwith "Nope"
Expected behavior
Compiles
Actual behavior
The line
member __.GetSpan n = failwith "Nope"
reports the error
FS0412 A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
Known workarounds
Include an unreachable dummy return value
member __.GetSpan n = failwith "Nope"; ReadOnlySpan()
Related information
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 39fd7b8.
For an interface method with a
byref<'t>return, it's not possible to provide an implementation that just throws an exceptionRepro steps
Expected behavior
Compiles
Actual behavior
The line
reports the error
FS0412 A type instantiation involves a byref type. This is not permitted by the rules of Common IL.Known workarounds
Include an unreachable dummy return value
Related information
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 39fd7b8.