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

Fix bug in erl_syntax.erl in two funs map_field_exact_value/1, map_field_assoc_value/1 #329

Closed
wants to merge 1 commit into from

Conversation

saa
Copy link
Contributor

@saa saa commented Apr 11, 2014

There is an error while retrieving the value in functions:

  • map_field_exact_value/1
  • map_field_assoc_value/1

We give the name of the field as the value.

-module(test).
-export([test/0]).
-compile([{parse_transform, portal_db_pt}]).

test() ->
    Value = 123,
    Result = #{ key => Value },
    Result.

AST for previous code:

[{attribute,1,file,{"src/test.erl",1}},
      {attribute,1,module,test},
      {attribute,1,lager_records,[]},
      {attribute,3,export,[{test,0}]},
      {attribute,5,compile,[]},
      {function,8,test,0,
          [{clause,8,[],[],
               [{match,9,{var,9,'Value'},{integer,9,123}},
                {match,10,
                    {var,10,'Result'},
                    {map,10,
                        [{map_field_assoc,10,{atom,10,key},{atom,10,key}}]}},
                {var,11,'Result'}]}]},
      {eof,12}]
[{map_field_assoc,10,{atom,10,key},{atom,10,key}}]}}, <--- this problem.

Typo in erl_syntax:map_field_exact_value/1 and erl_syntax:map_field_assoc_value/1:

(data(Node))#map_field_exact.name <--- 

* map_field_exact_value/1
* map_field_assoc_value/1
@saa saa changed the title Fix bug for get_value from maps tree Fix bug for get value from maps tree for result Apr 11, 2014
@saa saa changed the title Fix bug for get value from maps tree for result Fix bug in erl_syntax.erl for get value from maps tree for result Apr 13, 2014
@saa saa changed the title Fix bug in erl_syntax.erl for get value from maps tree for result Fix bug in erl_syntax.erl in two funs map_field_exact_value/1, map_field_assoc_value/1 Apr 13, 2014
@psyeugenic psyeugenic self-assigned this Apr 22, 2014
@psyeugenic
Copy link
Contributor

Could you add a testcase for this in syntax_tools also?

@saa
Copy link
Contributor Author

saa commented Apr 22, 2014

@psyeugenic add a testcase to lib/syntax_tools/test/syntax_tools_SUITE.erl ?

@psyeugenic
Copy link
Contributor

Yes that will work. I think there is only some smoke tests there atm so contributing testcases and incrementally building up tests there is what we want. =)

@psyeugenic
Copy link
Contributor

Fixed in #354
Closing issue.

@psyeugenic psyeugenic closed this May 15, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants