| Author |
Message |
< Erlang bugs mailing list ~ erl_syntax:type/1 fails for binary comprehensions |
| Guest |
Posted: Fri Apr 13, 2007 7:21 pm |
|
|
|
Guest
|
The code in erl_syntax:type/1 is missing a case for the bc (binary
comprehension) nodes produced by erl_parse.
As a result several of the erl_syntax functions fail when invoked with
syntax trees containing binary comprehensions, which in turn breaks a
whole bunch of tools (in my case some of distel's functionality).
This is bug is present in R11B-4. I haven't checked earlier releases.
Regards,
Matthias
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Sat Apr 14, 2007 6:45 am |
|
|
|
Guest
|
Matthias Radestock <matthias@sorted.org> writes:
> The code in erl_syntax:type/1 is missing a case for the bc (binary
> comprehension) nodes produced by erl_parse.
Here's an example demonstrating this problem:
(fun(Str) ->
{ok, Tokens, _} = erl_scan:string(Str),
{ok, [Expr]} = erl_parse:parse_exprs(Tokens),
erl_prettypr:format(Expr) end)
("<< <<X:1>> || X <- [] >>.").
** exited: {{badarg,
{bc,1,
{bin,
1,
[{bin_element,1,{var,1,'X'},{integer,1,1},default}]},
[{generate,1,{var,1,'X'},{nil,1}}]}},
[{erl_syntax,type,1},
{erl_prettypr,lay_2,2},
{erl_prettypr,format,2},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **
This, of course, isn't the only place in erl_syntax where support for
binary comprehensions is missing. There's also revert_root/1,
subtrees/1, and make_tree/3
Plus there should be various constructor/accessor functions analogous to
list_comp/2, list_comp_body/1, list_comp_template/1.
Then there are a whole bunch of modules that call into erl_syntax and
are also lacking cases for binary comprehension. For example
erl_prettypr and erl_tidy.
AFAIK binary comprehensions were introduced in R11B-0, which was
released on May 17, 2006. I am somewhat surprised that these bugs have
managed to slip through the net for almost a year. Granted, binary
comprehensions aren't that common, since they are a new feature. In
fact, it appears that the OTP sources only contain one use - in
eval_bits:convert_list/1 - and that was only introduced in R11B-4.
There is an easy way to spot this and other potential bugs in erl_syntax
and friends: run erl_tidy on the OTP sources. Perhaps that should be
added to the OTP test suite?
Regards,
Matthias.
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|