-
Notifications
You must be signed in to change notification settings - Fork 832
Closed
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnostics
Milestone
Description
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
abstract member Bar: int * int -> intI think compiler correctly throws an error here, but message of that error could be different to help people out of this mess.
Metadata
Metadata
Assignees
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnostics
Type
Projects
Status
Done