-
Notifications
You must be signed in to change notification settings - Fork 830
Open
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genFeature RequestNeeds-RFC
Milestone
Description
Not very important/common use case, but still creating an issue to keep track of it.
Code examples (link to tests):
type C5() =
static member X(p: C5 byref) = &p
let inline callX5<'T when 'T : (static member X: 'T byref -> 'T byref)> (x: 'T byref) = 'T.X &x
let mutable c5 = C5()
let g5 () = callX5<C5> &c5
type C6() =
static member X(p: C6 byref) = &p
// NOTE: you can declare trait call which returns the address of the thing provided, you just can't satisfy the constraint
let inline callX6<'T when 'T : (static member X: 'T byref -> 'T byref)> (x: 'T byref) = &'T.X &x
let mutable c6 = C6()
let g6 () = callX6<C6> &c6
Expected behavior
Code compiles and runs.
Actual behavior
Code doesn't compile and we get this error message at callX
invocation:
This expression was expected to have type 'byref<C5>' but here has type 'C5'
edgarfgp
Metadata
Metadata
Assignees
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genFeature RequestNeeds-RFC
Type
Projects
Status
New