-
Notifications
You must be signed in to change notification settings - Fork 831
Closed
Description
Type resolution reports FS0001 and FS0043 with the same error, that a constraint is required - but that constraint is already specified
Repro steps
Crazy code sample:
type Tuple =
static member inline TupleMap ((a, b), _ : Tuple) = fun f -> (f a, f b)
static member inline TupleMap ((a, b, c), _ : Tuple) = fun f -> (f a, f b, f c)
static member inline TupleMap ((a, b, c, d), _ : Tuple) = fun f -> (f a, f b, f c, f d)
static member inline Map f (x: 'Tin) : 'Tout =
let inline call_2 (a: ^a, b : ^b) = ((^a or ^b) : (static member TupleMap : ^b * _ -> ^t) (b, a))
call_2 (Unchecked.defaultof<Tuple>, x) f
type IOption<'T> =
abstract member Value : 'T
module Something =
let inline tupleMap f x = Tuple.Map f x
let inline addOptionValues< ^value, ^options, ^values, 'item when
'item :> IOption< ^value>
and (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> ('item -> ^value) -> ^values)>
(addUp : ^values -> ^value, sourceOptions : ^options) =
let getValue (i : 'item) = i.Value
let allValues : ^values = tupleMap getValue sourceOptions
let result : ^value = addUp allValues
resultThe line
let allValues : ^values = tupleMap getValue sourceOptionsGives the errors
Error FS0043 A type parameter is missing a constraint 'when (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> ('item -> ^value) -> ^values)'
Error FS0001 A type parameter is missing a constraint 'when (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> ('item -> ^value) -> ^values)'
Related information
Provide any related information
- Windows 10
- Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 55a3dc3.
- Microsoft Visual F# Tools 10.2 for F# 4.5