diff options
author | Hans Bolinder <[email protected]> | 2018-09-10 12:20:57 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2018-09-10 12:20:57 +0200 |
commit | 7db359b7a1d9b33b25750b29c92c6074ab415c45 (patch) | |
tree | d506e9998d089cd865fe8d0b25862db21b3bbcbc | |
parent | 4f11bb85a427d60ca55ffa63128f17b9dba98bd6 (diff) | |
download | otp-7db359b7a1d9b33b25750b29c92c6074ab415c45.tar.gz otp-7db359b7a1d9b33b25750b29c92c6074ab415c45.tar.bz2 otp-7db359b7a1d9b33b25750b29c92c6074ab415c45.zip |
syntax_tools: Correct unfolding of the stacktrace variable
The bug was introduced in 9ab233.
See also https://bugs.erlang.org/browse/ERL-719.
-rw-r--r-- | lib/syntax_tools/src/erl_syntax.erl | 2 | ||||
-rw-r--r-- | lib/syntax_tools/test/merl_SUITE.erl | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 758aff32fd..331081a07e 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -3897,7 +3897,7 @@ unfold_try_clauses(Cs) -> unfold_try_clause({clause, Pos, [{tuple, _, [{atom, _, throw}, V, - [{var, _, '_'}]]}], + {var, _, '_'}]}], Guard, Body}) -> {clause, Pos, [V], Guard, Body}; unfold_try_clause({clause, Pos, [{tuple, _, [C, V, Stacktrace]}], diff --git a/lib/syntax_tools/test/merl_SUITE.erl b/lib/syntax_tools/test/merl_SUITE.erl index 52bbd9b3b8..6389ad7738 100644 --- a/lib/syntax_tools/test/merl_SUITE.erl +++ b/lib/syntax_tools/test/merl_SUITE.erl @@ -30,13 +30,14 @@ %% Test cases -export([merl_smoke_test/1, - transform_parse_error_test/1]). + transform_parse_error_test/1, otp_15291/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [merl_smoke_test, - transform_parse_error_test]. + transform_parse_error_test, + otp_15291]. groups() -> []. @@ -101,6 +102,15 @@ transform_parse_error_test(_Config) -> [?Q("merl:qquote(2, \"{\", [{var, V}])")], []))), ok. +otp_15291(_Config) -> + C0 = merl:quote("() -> ok"), + {clause,1,[],[],[{atom,1,ok}]} = C0, + C2 = merl:quote("(_,_) -> ok"), + {clause,1,[{var,1,'_'},{var,1,'_'}],[],[{atom,1,ok}]} = C2, + C1 = merl:quote("(_) -> ok"), + {clause,1,[{var,1,'_'}],[],[{atom,1,ok}]} = C1, + ok. + %% utilities f(Ts) when is_list(Ts) -> |