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

Elvis crashes in erl_parse:abstract/2 #76

Closed
erszcz opened this issue Aug 5, 2014 · 3 comments
Closed

Elvis crashes in erl_parse:abstract/2 #76

erszcz opened this issue Aug 5, 2014 · 3 comments
Assignees
Labels

Comments

@erszcz
Copy link

erszcz commented Aug 5, 2014

Again with respect to https://github.com/lavrin/dcsp/ after I changed include directives to sidestep #75 Elvis crashes:

> elvis:rock(#{src_dirs => ["src", "include", "test"], rules => []}).
** exception error: no function clause matching erl_parse:abstract(undefined,{5,19}) (erl_parse.yrl, line 935)
     in function  erl_parse:record_fields/1 (erl_parse.yrl, line 792)
     in call from erl_parse:build_typed_attribute/2 (erl_parse.yrl, line 623)
     in call from erl_parse:yeccpars2_483/7 (erl_parse.yrl, line 80)
     in call from erl_parse:yeccpars0/5 (/net/isildur/ldisk/daily_build/17_prebuild_master-opu_o.2014-04-07_20/otp_src_17/bootstrap/lib/parsetools/include/yeccpre.hrl, line 56)
     in call from lists:map/2 (lists.erl, line 1237)
     in call from lists:map/2 (lists.erl, line 1237)
     in call from elvis_code:parse_tree/1 (src/elvis_code.erl, line 68)

Please see this gist for a dbg trace - unfortunately, the trace doesn't tell me much.

amilkr added a commit that referenced this issue Aug 5, 2014
…dirs

[Fixes #75][Fixes #76] Use config src_dirs to look for header files.
@erszcz
Copy link
Author

erszcz commented Aug 6, 2014

Still a problem, even with 6ecc0f9.
This is a bug in OTP or an invalid use of a function from OTP's erl_parse.yrl - depending on how one looks at it. The problem boils down to abstract/2 from erl_parse.yrl (line 935, spec on 927):

abstract(T, Line) when is_integer(Line) ->
    ...
abstract(T, Options) when is_list(Options) ->
    ...

The function can't take the {Row, Col} tuple {5,19}, it expects a line number or an option list with a line number and file encoding.

@elbrujohalcon elbrujohalcon reopened this Aug 6, 2014
elbrujohalcon added a commit that referenced this issue Aug 6, 2014
[#76] Added record definition clauses for to_map function.
jfacorro added a commit to inaka/aleppo that referenced this issue Aug 6, 2014
unbalancedparentheses pushed a commit to inaka/aleppo that referenced this issue Aug 6, 2014
@jfacorro
Copy link
Contributor

jfacorro commented Aug 6, 2014

@Lavrin After fixing the problem about the abstract/2 function other issues related to include files came up, so we ended up modifying the aleppo library to make a best effort when preprocessing source code, thus avoiding failure when something goes wrong (e.g. an included file is not found or a macro is not defined).

Running elvis on your dcsp project now works, reporting some stuff. Most Missing space after "," on line X messages refer to text on comments which we will fix through issue #79.

I'll leave this issue open in case you find another problem we did not detect.

Thanks again for taking the time to report this problem.

@igaray igaray closed this as completed in 3666364 Aug 6, 2014
@jfacorro jfacorro reopened this Aug 6, 2014
@jfacorro jfacorro added the bug label Aug 6, 2014
@jfacorro jfacorro self-assigned this Aug 6, 2014
@erszcz
Copy link
Author

erszcz commented Aug 7, 2014

I confirm, 3666364 works on dcsp. Thanks for your interest!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants