-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix(gnovm): annotate specific reason a value does not implement an interface #2492
fix(gnovm): annotate specific reason a value does not implement an interface #2492
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2492 +/- ##
==========================================
+ Coverage 55.01% 55.03% +0.01%
==========================================
Files 595 595
Lines 79662 79665 +3
==========================================
+ Hits 43828 43842 +14
+ Misses 32518 32509 -9
+ Partials 3316 3314 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3197a35
to
115c7dc
Compare
115c7dc
to
21876b5
Compare
21876b5
to
a09759d
Compare
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.
Looks good, a bit of reorganization needed
a09759d
to
09e0331
Compare
09e0331
to
bb3bc87
Compare
…terface (gnolang#2492) Related to gnolang#1684 . This is a first draft that will increment the amount of information Gno returns in the case of an struct not implementing a defined interface. ### First Case `A non defined function on interface` ```go package main type Car interface{ Run(speed int) } type Toyota struct {} func main(){ var car Car = &Toyota{} } ``` **Before** we had something like: `panic: *main.Toyota does not implement main.Car [recovered]` **now**: `panic: *main.Toyota does not implement main.Car (missing method Run) [recovered]` ### Second Case `A defined function with bad type on function signature` ```go package main type Car interface{ Run(speed int) } type Toyota struct {} func (toyota *Toyota) Run(quick bool){ } func main(){ var car Car = &Toyota{} } ``` **Before** we had something like: `panic: *main.Toyota does not implement main.Car [recovered]` **now**: `panic: *main.Toyota does not implement main.Car (wrong type for method Run) [recovered]` ### Third Case `A defined function with a pointer receiver but not pointer variable` ```go package main type Car interface { Run() } type Toyota struct { } func (t *Toyota) Run() { } func main() { var car Car = Toyota{} } ``` **Before** we had something like: `panic: *main.Toyota does not implement main.Car [recovered]` **now**: `panic: main.Toyota does not implement main.Car (method Run has pointer receiver):` <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details>
Related to #1684 .
This is a first draft that will increment the amount of information Gno returns in the case of an struct not implementing a defined interface.
First Case
A non defined function on interface
Before we had something like:
panic: *main.Toyota does not implement main.Car [recovered]
now:
panic: *main.Toyota does not implement main.Car (missing method Run) [recovered]
Second Case
A defined function with bad type on function signature
Before we had something like:
panic: *main.Toyota does not implement main.Car [recovered]
now:
panic: *main.Toyota does not implement main.Car (wrong type for method Run) [recovered]
Third Case
A defined function with a pointer receiver but not pointer variable
Before we had something like:
panic: *main.Toyota does not implement main.Car [recovered]
now:
panic: main.Toyota does not implement main.Car (method Run has pointer receiver):
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description