You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type IFoo =
abstract member Bar: (int * int) -> int
type Foo =
interface IFoo with
member _.Bar (x, y) = x + y
Current behavior:
error FS0856: This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:
abstract IFoo.Bar: (int * int) -> int
Problem
Interface declares incoming argument as a tuple (a lot of times by mistake, alas)
But Implementation defines two separate arguments, so we got an error.
And this error is a noob trap. A lot of questions "why such code doesn't work?"
Fix is simple
either add additional layer of parentheses
member_.Bar((x,y))= x + y
or remove parentheses from interface declaration
abstractmember Bar:int*int->int
I think compiler correctly throws an error here, but message of that error could be different to help people out of this mess.
The text was updated successfully, but these errors were encountered:
Repro
Current behavior:
Problem
Interface declares incoming argument as a tuple (a lot of times by mistake, alas)
But Implementation defines two separate arguments, so we got an error.
And this error is a noob trap. A lot of questions "why such code doesn't work?"
Fix is simple
I think compiler correctly throws an error here, but message of that error could be different to help people out of this mess.
The text was updated successfully, but these errors were encountered: