Skip to content

Instantly share code, notes, and snippets.

@erszcz
Created August 5, 2014 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erszcz/0c0d3e472ce967ee9a6e to your computer and use it in GitHub Desktop.
Save erszcz/0c0d3e472ce967ee9a6e to your computer and use it in GitHub Desktop.
Elvis crashes in `erl_parse:abstract/2`
2> dbg:tracer().
{ok,<0.38.0>}
3> dbg:p(all, call).
{ok,[{matched,nonode@nohost,26}]}
4> dbg:tp(elvis_code, x).
{ok,[{matched,nonode@nohost,15},{saved,x}]}
5> dbg:tp(erl_parse, x).
{ok,[{matched,nonode@nohost,20},{saved,x}]}
6>
6> elvis:rock(#{src_dirs => ["src", "include", "test"], rules => []}).
(<0.43.0>) call erl_parse:parse_exprs([{atom,2,elvis},
{':',2},
{atom,2,rock},
{'(',2},
{'#',2},
{'{',2},
{atom,2,src_dirs},
{'=>',2},
{'[',2},
{string,2,"src"},
{',',2},
{string,2,"include"},
{',',2},
{string,2,"test"},
{']',2},
{',',2},
{atom,2,rules},
{'=>',2},
{'[',2},
{']',2},
{'}',2},
{')',2},
{dot,2}])
(<0.43.0>) returned from erl_parse:parse_exprs/1 -> {ok,
[{call,2,
{remote,2,
{atom,2,elvis},
{atom,2,rock}},
[{map,2,
[{map_field_assoc,2,
{atom,2,src_dirs},
{cons,2,
{string,2,"src"},
{cons,2,
{string,2,
"include"},
{cons,2,
{string,2,
"test"},
{nil,2}}}}},
{map_field_assoc,2,
{atom,2,rules},
{nil,2}}]}]}]}
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call erl_parse:set_line(2,#Fun<erl_lint.9.91988152>)
(<0.36.0>) returned from erl_parse:set_line/2 -> [{line,{"nofile",2}}]
(<0.36.0>) call elvis_code:parse_tree(<<"-module(dcsp).\n\n-behaviour(application).\n\n%% Application callbacks\n-export([start/2,\n stop/1]).\n\n%% User API\n-export([start/0,\n solve/1]).\n\n-include(\"include/dcsp.hrl\").\n\n%% -------------------------------------------------------------------\n%% Application callbacks\n%% -------------------------------------------------------------------\n\nstart(_StartType, _StartArgs) ->\n dcsp_sup:start_link().\n\nstop(_State) ->\n ok.\n\n%% -------------------------------------------------------------------\n%% User API\n%% -------------------------------------------------------------------\n\nstart() ->\n application:start(dcsp).\n\n-spec solve(problem()) -> term() | no_solution.\nsolve(Problem) ->\n Self = self(),\n Ref = make_ref(),\n {ok, Pid} = dcsp_solver:start(Problem, mk_result_handler(Self, Ref)),\n receive\n {result, Ref, Result} ->\n Result;\n {no_solution, Ref} ->\n no_solution\n after 5000 ->\n exit(Pid, shutdown),\n timeout\n end.\n\nmk_result_handler(Self, Ref) ->\n fun({result, Result}) ->\n Self ! {result, Ref, Result};\n (no_solution) ->\n Self ! {no_solution, Ref}\n end.\n">>)
(<0.36.0>) call erl_parse:parse_form([{'-',[{line,1},{column,1},{text,"-"}]},
{atom,[{line,1},{column,2},{text,"module"}],module},
{'(',[{line,1},{column,8},{text,"("}]},
{atom,[{line,1},{column,9},{text,"dcsp"}],dcsp},
{')',[{line,1},{column,13},{text,")"}]},
{dot,[{line,1},{column,14},{text,".\n"}]}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
[{line,1},
{column,2},
{text,"module"}],
module,dcsp}}
(<0.36.0>) call erl_parse:parse_form([{'-',[{line,3},{column,1},{text,"-"}]},
{atom,[{line,3},{column,2},{text,"behaviour"}],behaviour},
{'(',[{line,3},{column,11},{text,"("}]},
{atom,[{line,3},{column,12},{text,"application"}],application},
{')',[{line,3},{column,23},{text,")"}]},
{dot,[{line,3},{column,24},{text,".\n"}]}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
[{line,3},
{column,2},
{text,"behaviour"}],
behaviour,application}}
(<0.36.0>) call erl_parse:parse_form([{'-',[{line,6},{column,1},{text,"-"}]},
{atom,[{line,6},{column,2},{text,"export"}],export},
{'(',[{line,6},{column,8},{text,"("}]},
{'[',[{line,6},{column,9},{text,"["}]},
{atom,[{line,6},{column,10},{text,"start"}],start},
{'/',[{line,6},{column,15},{text,"/"}]},
{integer,[{line,6},{column,16},{text,"2"}],2},
{',',[{line,6},{column,17},{text,","}]},
{atom,[{line,7},{column,10},{text,"stop"}],stop},
{'/',[{line,7},{column,14},{text,"/"}]},
{integer,[{line,7},{column,15},{text,"1"}],1},
{']',[{line,7},{column,16},{text,"]"}]},
{')',[{line,7},{column,17},{text,")"}]},
{dot,[{line,7},{column,18},{text,".\n"}]}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
[{line,6},
{column,2},
{text,"export"}],
export,
[{start,2},{stop,1}]}}
(<0.36.0>) call erl_parse:parse_form([{'-',[{line,10},{column,1},{text,"-"}]},
{atom,[{line,10},{column,2},{text,"export"}],export},
{'(',[{line,10},{column,8},{text,"("}]},
{'[',[{line,10},{column,9},{text,"["}]},
{atom,[{line,10},{column,10},{text,"start"}],start},
{'/',[{line,10},{column,15},{text,"/"}]},
{integer,[{line,10},{column,16},{text,"0"}],0},
{',',[{line,10},{column,17},{text,","}]},
{atom,[{line,11},{column,10},{text,"solve"}],solve},
{'/',[{line,11},{column,15},{text,"/"}]},
{integer,[{line,11},{column,16},{text,"1"}],1},
{']',[{line,11},{column,17},{text,"]"}]},
{')',[{line,11},{column,18},{text,")"}]},
{dot,[{line,11},{column,19},{text,".\n"}]}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
[{line,10},
{column,2},
{text,"export"}],
export,
[{start,0},{solve,1}]}}
(<0.36.0>) call erl_parse:parse_form([{'-',1},
{atom,1,file},
{'(',1},
{string,1,"/Users/erszcz/work/bitbucket.erszcz/dcsp/include/dcsp.hrl"},
{',',1},
{integer,1,1},
{')',1},
{dot,1}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,1,file,
{"/Users/erszcz/work/bitbucket.erszcz/dcsp/include/dcsp.hrl",
1}}}
(<0.36.0>) call erl_parse:parse_form([{'-',{1,1}},
{atom,{1,2},type},
{atom,{1,7},aid},
{'(',{1,10}},
{')',{1,11}},
{'::',{1,13}},
{atom,{1,16},pos_integer},
{'(',{1,27}},
{')',{1,28}},
{dot,{1,29}}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
{1,2},
type,
{aid,
{type,
{1,16},
pos_integer,[]},
[]}}}
(<0.36.0>) call erl_parse:parse_form([{'-',{3,1}},
{atom,{3,2},type},
{atom,{3,7},set},
{'(',{3,10}},
{var,{3,11},'_ElementType'},
{')',{3,23}},
{'::',{3,25}},
{atom,{3,28},set},
{'(',{3,31}},
{')',{3,32}},
{dot,{3,33}}])
(<0.36.0>) returned from erl_parse:parse_form/1 -> {ok,
{attribute,
{3,2},
type,
{set,
{type,{3,28},set,[]},
[{var,
{3,11},
'_ElementType'}]}}}
(<0.36.0>) call erl_parse:parse_form([{'-',{5,1}},
{atom,{5,2},record},
{'(',{5,8}},
{atom,{5,9},problem},
{',',{5,16}},
{'{',{5,18}},
{atom,{5,19},module},
{'::',{5,26}},
{atom,{5,29},atom},
{'(',{5,33}},
{')',{5,34}},
{',',{5,35}},
{atom,{6,19},num_agents},
{'::',{6,30}},
{atom,{6,33},pos_integer},
{'(',{6,44}},
{')',{6,45}},
{',',{6,46}},
{atom,{7,19},domains},
{'::',{7,27}},
{atom,{7,30},list},
{'(',{7,34}},
{atom,{7,35},term},
{'(',{7,39}},
{')',{7,40}},
{')',{7,41}},
{',',{7,42}},
{atom,{8,19},initial},
{'::',{8,27}},
{atom,{8,30},list},
{'(',{8,34}},
{atom,{8,35},term},
{'(',{8,39}},
{')',{8,40}},
{')',{8,41}},
{',',{8,42}},
{atom,{9,19},constraints},
{'::',{9,31}},
{atom,{9,34},list},
{'(',{9,38}},
{atom,{9,39},term},
{'(',{9,43}},
{')',{9,44}},
{')',{9,45}},
{'}',{9,46}},
{')',{9,47}},
{dot,{9,48}}])
(<0.36.0>) exception_from {erl_parse,parse_form,1} {error,function_clause}
(<0.36.0>) exception_from {elvis_code,parse_tree,1} {error,function_clause}
** 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment