Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve Error Reporting: When implementation is missing necessary overrides, report a list of them #4982

Closed
Tracked by #1103
smoothdeveloper opened this issue May 23, 2018 · 1 comment

Comments

@smoothdeveloper
Copy link
Contributor

related: #1103, #4967

What

open System
open System.IO
type IFoo =
  abstract member Foo : t:Type * r:TextReader -> obj
  abstract member Bar<'t> : TextReader -> 't
  abstract member Baz<'t> : TextReader -> 't

type Foo() =
  interface IFoo with
    member x.Foo(t, reader) = obj() 

this currently gives:

error FS0366: No implementation was given for 'abstract member IFoo.Bar : TextReader -> 't'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.

Why

Overrides generally come in more than a bunch, it is tedious to fix one and wait for the compiler to list the next one, one by one...

How

I propose that instead, we handle those cases:

single override is missing: behaviour unchanged

more than one and less than ten overrides missing: list missing overrides exhaustively

error FS0366: No implementation was given for those members:
'abstract member IFoo.Bar : TextReader -> 't'
'abstract member IFoo.Baz : TextReader -> 't'
Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.

more than ten overrides missing: list the ten first missing overrides

error FS0366: No implementation was given for those members (some results omitted):
'abstract member IFoo.Bar : TextReader -> 't'
'abstract member IFoo.Baz : TextReader -> 't'
....
Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.

Please let me know if there are any adjustments / proposals to make this better, I'm looking at CheckDispatchSlotsAreImplemented which I'll cleanup and prepare to support better logic.

@cartermp
Copy link
Contributor

Tagging with appropriate milestone

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants