From 231dfd776f4ce1777e63aa319d89d573449224b8 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 22 Feb 2022 17:00:17 +0100 Subject: [PATCH] Support Erlang 25 in "make options": returns attribute with simpler syntax This was introduced in Erlang/OTP 25.0-rc1 https://erlang.org/download/otp_src_25.0-rc1.readme https://github.com/erlang/otp/pull/5509 OTP-17894 Application(s): syntax_tools Related Id(s): PR-5509 The erl_syntax_lib:analyze_attribute/1 function would return {Name, {Name, Value}} instead of {Name, Value} (which is the documented return value). --- tools/opt_types.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/opt_types.sh b/tools/opt_types.sh index 8de6d8945..92cd943d8 100755 --- a/tools/opt_types.sh +++ b/tools/opt_types.sh @@ -524,6 +524,8 @@ fold_opt(File, Fun, Acc, AbsCode) -> Fun(File, {#state.defaults, Form}, Acc1); {attribute, {spec, {spec, {{options, 0}, Spec}}}} -> Fun(File, {#state.specs, hd(Spec)}, Acc1); + {attribute, {spec, {{options, 0}, Spec}}} -> + Fun(File, {#state.specs, hd(Spec)}, Acc1); _ -> Acc1 end @@ -539,6 +541,8 @@ fold_mod_opt(File, Fun, Acc, AbsCode) -> Fun(File, {#state.mod_defaults, Form}, Acc1); {attribute, {spec, {spec, {{mod_options, 1}, Spec}}}} -> Fun(File, {#state.mod_specs, hd(Spec)}, Acc1); + {attribute, {spec, {{mod_options, 1}, Spec}}} -> + Fun(File, {#state.mod_specs, hd(Spec)}, Acc1); _ -> Acc1 end @@ -572,6 +576,8 @@ is_behaviour(AbsCode, Mod) -> {attribute, {Attr, {_, Mod}}} when Attr == behaviour orelse Attr == behavior -> true; + {attribute, {behaviour, Mod}} -> + true; _ -> false end