-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error messages: report a list of missing overrides #4983
error messages: report a list of missing overrides #4983
Conversation
elif argTys.Length <> vargtys.Length then | ||
fail(Error(FSComp.SR.typrelMemberDoesNotHaveCorrectNumberOfArguments(FormatOverride denv overrideBy, FormatMethInfoSig g amap m denv dispatchSlot), overrideBy.Range)) | ||
elif not (listSameLength argTys vargtys) then | ||
fail(Error(FSComp.SR.typrelMemberDoesNotHaveCorrectNumberOfArguments(FormatOverride denv overrideBy, formatMethodInfoSignature dispatchSlot), overrideBy.Range)) | ||
elif mtps.Length <> fvmtps.Length then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If mtps
is a list, use listSameLength
here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmh it is a Typars, which in fact is a list, I'll change it as well.
It would be nice if type aliases in a tooltip were shown at the bottom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is already an issue/suggestion. It would be easy to implement, the hard part is to decide how to represent it on the tooltip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the main logic to
I'll be working on few code samples to add to the test suite, is If you have evil code idea to check I'm not breaking anything or that we have all cases cornered, please share. Sample output for now: Microsoft (R) F# Interactive version 10.1.0 for F# 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System
- open System.IO;;
>
- type IFoo1 =
- abstract member Foo : t:Type * r:TextReader -> obj
- abstract member Bar<'t> : TextReader -> 't
- abstract member Baz<'t> : TextReader -> 't
-
- type Foo1() =
- interface IFoo1 with
- member x.Foo(t, reader) = obj()
- ;;
interface IFoo1 with
------------^^^^^
stdin(10,13): error FS0366: No implementation was given for those members:
'abstract member IFoo1.Bar : TextReader -> 't'
'abstract member IFoo1.Baz : TextReader -> 't'
Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
> type IFoo2 =
- abstract member Foo : t:Type * r:TextReader -> obj
- abstract member Bar<'t> : TextReader -> 't
- abstract member Baz<'t> : TextReader -> 't
- abstract member Baz1<'t> : TextReader -> 't
- abstract member Baz2<'t> : TextReader -> 't
- abstract member Baz3<'t> : TextReader -> 't
- abstract member Baz4<'t> : TextReader -> 't
- abstract member Baz5<'t> : TextReader -> 't
- abstract member Baz6<'t> : TextReader -> 't
- abstract member Baz7<'t> : TextReader -> 't
- abstract member Baz8<'t> : TextReader -> 't
- abstract member Baz9<'t> : TextReader -> 't
-
- type Foo2() =
- interface IFoo2 with
- member x.Foo(t, reader) = obj()
- ;;
interface IFoo2 with
------------^^^^^
stdin(28,13): error FS0366: No implementation was given for those members (some results omitted):
'abstract member IFoo2.Bar : TextReader -> 't'
'abstract member IFoo2.Baz : TextReader -> 't'
'abstract member IFoo2.Baz1 : TextReader -> 't'
'abstract member IFoo2.Baz2 : TextReader -> 't'
'abstract member IFoo2.Baz3 : TextReader -> 't'
'abstract member IFoo2.Baz4 : TextReader -> 't'
'abstract member IFoo2.Baz5 : TextReader -> 't'
'abstract member IFoo2.Baz6 : TextReader -> 't'
'abstract member IFoo2.Baz7 : TextReader -> 't'
'abstract member IFoo2.Baz8 : TextReader -> 't'
Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
> |
e2a8a07
to
c76b594
Compare
I'm not understanding why CI part 3 & 4 fail with this error:
those are defined in https://github.com/Microsoft/visualfsharp/pull/4983/files#diff-0e57ebf050db850b5efdd7e2cb13e725 and it compiles in part 1 & 2. |
You have to update the FSComp files at least. See DEVGUIDE.md
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, once it's green let's get it merged.
Requested a few minor changes
85126d4
to
5647094
Compare
* use mutable instead of ref * avoid calling List.Length just to compare if the length is equal (I believe this should be reusable function outside, but don't know where it is if it exists, or where to put it) * shorten call to FormatMethInfoSig which is repeated more than any others in many places * for loop instead of List.iter * declare local instead of match over long expression * remove spurious calls to ignore and unit
…ngle compile error message.
* update the error names in FSComp to keep the typrelNoImplementationGiven prefix atomic
….fs fsharpqa tests. Note that multiline error messages can't be matched as precisely, we need to drop the status="error" and id="..." from the <Expects> tags to match individual lines of the message separately.
5647094
to
445e82f
Compare
This is green and I think all comments have been addressed. |
@dsyme thanks for the review, is there a concern about https://github.com/Microsoft/visualfsharp/pull/4983/files#diff-87f5261ee04fbbcd39ff79a83af01e01R270 where we allocate an empty ResizeArray at the top level of I could change this to a mutable Edit: a list is initialized with empty array and first add to it pushes it to 4 elements, so this is basically not a concern. |
thanks for this Kevin |
This is going to be for #4982, right now, it is just a first pass at looking at the code and cleaning a bit without any behaviour change.
I intend to look at
noimpl
which is the location we report the error.Instead I plan to make it an accumulator which will raise the error (with the expected message) if more than 10 missing overrides have been encountered, otherwise it will append, and then it will be checked before returning to construct the expected message if needed and raise it.
Please let me know if you see any issue with that plan.
Status: