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

Wrong error location for deprecated method usage inside macro #8211

Open
leonklingele opened this issue Sep 23, 2019 · 6 comments
Open

Wrong error location for deprecated method usage inside macro #8211

leonklingele opened this issue Sep 23, 2019 · 6 comments

Comments

@leonklingele
Copy link

This seems to be an issue with the stdlib of Crystal which itself is using deprecated features.

$ crystal build --error-on-warnings src/invidious.cr
In /usr/share/crystal/src/object.cr:14:12
 14 | !(self == other)
             ^
Warning: Deprecated JSON::PullParser::Kind#==. JSON::PullParser#kind now is an enum, please use that instead of symbols
A total of 1 warnings were found.
The command "crystal build --error-on-warnings src/invidious.cr" failed and exited with 1 during .

See https://travis-ci.org/leonklingele/invidious/jobs/588639545#L247-L255

@leonklingele
Copy link
Author

Issue was introduced in #7966.

@asterite
Copy link
Member

The error message is probably wrong and should point to the location where the deprecated JSON::PullParser::Kind#== is called. It seems the full trace of the warning is not shown, otherwise it would point you to the correct location.

It seems the problem is this line: https://github.com/leonklingele/invidious/blob/8189dd3268572b695066196715ee4a77662de78a/src/invidious/helpers/patch_mapping.cr#L53

change it to:

    until %pull.kind.end_object?

and the warning will go away.

Sorry for the bad error message!

@leonklingele
Copy link
Author

leonklingele commented Sep 23, 2019

Thanks for helping @asterite :) This did indeed resolve the issue.
Is there an easy way to fix the misleading error message?

BTW: Building with --error-trace doesn't show where the actual problem is located either.

@asterite
Copy link
Member

Not easy, it's a compiler bug. Maybe related to the fact that this happens inside a macro.

@leonklingele
Copy link
Author

Shall I open a separate issue for this?

@asterite
Copy link
Member

I think we can use this issue to track the problem

@jhass jhass changed the title stdlib of v0.31.0 is using deprecated features, makes app fail to build with --error-on-warnings Wrong error location for deprecated method usage inside macro Sep 24, 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

3 participants