Skip to content
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

Report include/inheritance location for missing abstract method implementation #8029

Open
bararchy opened this issue Aug 2, 2019 · 7 comments

Comments

@bararchy
Copy link
Contributor

bararchy commented Aug 2, 2019

So, this seems to be the most cryptic error message up to date, can we get some info added on where the actual issue is?

Parse:                             00:00:00.000269260 (   0.50MB)
Semantic (top level):              00:00:00.293037005 (  91.04MB)
Semantic (new):                    00:00:00.002857463 (  91.04MB)
Semantic (type declarations):      00:00:00.033981050 (  91.04MB)
In /usr/share/crystal/src/enumerable.cr:37:16

 37 | abstract def each(&block : T -> _)
                   ^---
Error: abstract `def Enumerable(T)#each(&block)` must be implemented by SerialObject

This error is with --error-trace enabled

@ysbaddaden
Copy link
Contributor

As the error message says: you must implement SerialObject#each(&block) to satisfy the Enumerable#each(&block) abstract method.

Abstract methods on generics weren't properly checked before 0.30.

@asterite
Copy link
Member

asterite commented Aug 2, 2019

Maybe we can somehow also point to where the class is defined. It's tough because so far errors only have one location.

@asterite
Copy link
Member

asterite commented Aug 2, 2019

I also wonder whether that should have been a warning instead of an error, at least for 0.30.0. I can't remember if this was checked for generics before...

@RX14
Copy link
Contributor

RX14 commented Aug 2, 2019

The error message is hardly cryptic, but the location of the error should be the location of include Enumerable(T) in the class.

@asterite
Copy link
Member

asterite commented Aug 2, 2019

Oh, that's a good idea... but it's also hard to. implement because we don't keep track of where is the include of a class.

@RX14
Copy link
Contributor

RX14 commented Aug 2, 2019

It might be hard to implement, but I think it is worth implementing...

Also, the abstract `def Enumerable(T)#each(&block)` looks weird, the def should probably go.

This is a fairly minor visual issue, so it doesn't have to be implemented right now.

@bararchy
Copy link
Contributor Author

bararchy commented Aug 2, 2019

So, my main issue was that as we have quite a big project with multiple devs I thought that SerialObject is something from Crystal, I would have figured it out sooner if for example it would at least point out that SerialObject was in this and that file in this and that line (just the class\module etc..)

@jhass jhass changed the title Crystal 0.30.0 - abstract return types error Report include/inheritance location for missing abstract method implementation Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants