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

'exprec' fails to process empty records #2

Open
superbobry opened this issue Mar 11, 2012 · 4 comments
Open

'exprec' fails to process empty records #2

superbobry opened this issue Mar 11, 2012 · 4 comments

Comments

@superbobry
Copy link

I know the example bellow doesn't make much sense, but anyway:

-module(test).
-record(test, {}).
-compile({parse_transform, exprecs}).
-export_records([test]).

... results in the following error with the latest version of parse_trans and Erlang R15B:

src/test.erl:none: internal error in lint_module;
crash reason: {function_clause,
               [{erl_lint,'-compiler_options/1-lc$^0/1-0-',
                 [{error,
                   [{"src/test.erl",
                     [{9999,parse_trans,
                       {function_clause,
                        [{exprecs,funspec,
                          [5,'#pos-',[]],
                          [{file,"src/exprecs.erl"},{line,735}]},
                         {exprecs,f_pos_2,2,
                          [{file,"src/exprecs.erl"},{line,991}]},
                         {exprecs,generate_accessors,2,
                          [{file,"src/exprecs.erl"},{line,608}]},
                         {exprecs,generate_specs_and_accessors,2,
                          [{file,"src/exprecs.erl"},{line,513}]},
                         {exprecs,verify_generated,3,
                          [{file,"src/exprecs.erl"},{line,526}]},
                         {exprecs,do_transform,2,
                          [{file,"src/exprecs.erl"},{line,425}]},
                         {parse_trans,top,3,
                          [{file,"src/parse_trans.erl"},{line,336}]},
                         {compile,'-foldl_transform/2-anonymous-2-',2,
                          [{file,"compile.erl"},{line,841}]}]}}]}]}],
                 [{file,"erl_lint.erl"},{line,474}]},
                {erl_lint,compiler_options,1,
                 [{file,"erl_lint.erl"},{line,474}]},
                {erl_lint,module,3,[{file,"erl_lint.erl"},{line,469}]},
                {compile,lint_module,1,[{file,"compile.erl"},{line,906}]},
                {compile,'-internal_comp/4-anonymous-1-',2,
                 [{file,"compile.erl"},{line,269}]},
                {compile,fold_comp,3,[{file,"compile.erl"},{line,287}]},
                {compile,internal_comp,4,[{file,"compile.erl"},{line,271}]},
                {compile,internal,3,[{file,"compile.erl"},{line,246}]}]}
@uwiger
Copy link
Owner

uwiger commented Mar 11, 2012

Hmm, :)

Thanks. I'll take a look at this a bit later on.

BR,
Ulf

Den 11 mars 2012 12:27 skrev Sergei Lebedev <
[email protected]

:

I know the example bellow doesn't make much sense, but anyway:

-module(test).
-record(test, {}).
-compile({parse_transform, exprecs}).
-export_records([test]).

... results in the following error with the latest version of
parse_trans and Erlang R15B:

src/test.erl:none: internal error in lint_module;
crash reason: {function_clause,
              [{erl_lint,'-compiler_options/1-lc$^0/1-0-',
                [{error,
                  [{"src/test.erl",
                    [{9999,parse_trans,
                      {function_clause,
                       [{exprecs,funspec,
                         [5,'#pos-',[]],
                         [{file,"src/exprecs.erl"},{line,735}]},
                        {exprecs,f_pos_2,2,
                         [{file,"src/exprecs.erl"},{line,991}]},
                        {exprecs,generate_accessors,2,
                         [{file,"src/exprecs.erl"},{line,608}]},
                        {exprecs,generate_specs_and_accessors,2,
                         [{file,"src/exprecs.erl"},{line,513}]},
                        {exprecs,verify_generated,3,
                         [{file,"src/exprecs.erl"},{line,526}]},
                        {exprecs,do_transform,2,
                         [{file,"src/exprecs.erl"},{line,425}]},
                        {parse_trans,top,3,
                         [{file,"src/parse_trans.erl"},{line,336}]},
                        {compile,'-foldl_transform/2-anonymous-2-',2,
                         [{file,"compile.erl"},{line,841}]}]}}]}]}],
                [{file,"erl_lint.erl"},{line,474}]},
               {erl_lint,compiler_options,1,
                [{file,"erl_lint.erl"},{line,474}]},
               {erl_lint,module,3,[{file,"erl_lint.erl"},{line,469}]},
               {compile,lint_module,1,[{file,"compile.erl"},{line,906}]},
               {compile,'-internal_comp/4-anonymous-1-',2,
                [{file,"compile.erl"},{line,269}]},
               {compile,fold_comp,3,[{file,"compile.erl"},{line,287}]},
               {compile,internal_comp,4,[{file,"compile.erl"},{line,271}]},
               {compile,internal,3,[{file,"compile.erl"},{line,246}]}]}

Reply to this email directly or view it on GitHub:
#2

@w495
Copy link

w495 commented Sep 5, 2012

And what was wrong?

@uwiger
Copy link
Owner

uwiger commented Sep 5, 2012

I haven't fixed it yet. The problem is that the function '#pos-'(Rec, Attr) will never return for an empty record. The code that generates a type signature for all possible return values was not prepared for that.

@w495
Copy link

w495 commented Sep 5, 2012

I'd the same problem with parse_transform (https://github.com/w495/erlang_decorators), but I've solved it with
erl_parse:abstract(Some, Line).

uwiger added a commit that referenced this issue Jul 13, 2018
run rebar3 eunit in travis

By adding a `test` profile that at least compiles the `examples` code, CI is improved a bit more.
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

3 participants