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

Defines not supported inside guard expressions #2

Open
helllamer opened this issue Aug 2, 2012 · 1 comment
Open

Defines not supported inside guard expressions #2

helllamer opened this issue Aug 2, 2012 · 1 comment

Comments

@helllamer
Copy link

It looks like, defines is not properly substituded in guard expressions.

-module(ar_test_controller, [Req]).

-define(is_ok(X), is_list(X)).

test('GET', [X]) when ?is_ok(X) ->
    ok.

rebar compile cause following error:

ERROR: pre_compile failed while processing /home/user/chicagoboss/ar:
{'EXIT',{{badmatch,{error,[{"/home/user/chicagoboss/ar/src/controller/ar_test_controller.erl",
                            [{{5,24},erl_lint,illegal_guard_expr}]}]}},
         [{boss_load,load_all_modules,3,
                     [{file,"src/boss/boss_load.erl"},{line,28}]},
          {boss_load,load_all_modules_and_emit_app_file,2,
                     [{file,"src/boss/boss_load.erl"},{line,42}]},
          {boss_rebar,compile,4,
                      [{file,"../ChicagoBoss/priv/rebar/boss_rebar.erl"},
                       {line,85}]},
          {boss_plugin,pre_compile,2,
                       [{file,"priv/rebar/boss_plugin.erl"},{line,105}]},
          {rebar_core,run_modules,4,[]},
          {rebar_core,execute,4,[]},
          {rebar_core,process_dir0,6,[]},
          {rebar_core,process_commands,2,[]}]}}
make: *** [erl] Error 1

Guard expressions for case clauses produces same errors.

@evanmiller
Copy link
Contributor

Thanks. I am aware of the problem. Right now macros are compiled to funs (which aren't allowed in guards) but this behavior should change.

danikp pushed a commit that referenced this issue Nov 5, 2014
….lists

Support token attributes as proplists
drlinux referenced this issue in drlinux/erl_slug Jan 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants