diff --git a/rebar.config b/rebar.config index eb507ddc..87a18fbe 100644 --- a/rebar.config +++ b/rebar.config @@ -42,7 +42,7 @@ %% == Dependencies and plugins == -{deps, [{katana_code, "~> 2.5.1"}]}. +{deps, [{katana_code, "~> 2.5.2"}]}. {project_plugins, [ {rebar3_hank, "~> 2.0.0"}, diff --git a/rebar.lock b/rebar.lock index 469ef3ff..79016f64 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,8 +1,8 @@ {"1.2.0", -[{<<"katana_code">>,{pkg,<<"katana_code">>,<<"2.5.1">>},0}]}. +[{<<"katana_code">>,{pkg,<<"katana_code">>,<<"2.5.2">>},0}]}. [ {pkg_hash,[ - {<<"katana_code">>, <<"6C1105FF186FB98982AD53ABC9D8E6C6B9700B51287389E89B208E12F472C362">>}]}, + {<<"katana_code">>, <<"B2A44D9F406AEAA1D811C4118D8A951844F02E4A24CB15AD0C09E4C735CBA3A7">>}]}, {pkg_hash_ext,[ - {<<"katana_code">>, <<"CC5E5CE267E4C5C434C39077A9C77D03341CAE442EF46703AC1D2010994BD185">>}]} + {<<"katana_code">>, <<"1E9B989BE9014DEE124B590BAD154F51C186F2C5FE086A209FA5CF80FBD9E82B">>}]} ]. diff --git a/test/examples/fail_prefer_strict_generators.erl b/test/examples/fail_prefer_strict_generators.erl index 6fb9c714..f4428a10 100644 --- a/test/examples/fail_prefer_strict_generators.erl +++ b/test/examples/fail_prefer_strict_generators.erl @@ -7,12 +7,13 @@ -export([bitstrings/1, lists/1, maps/1, edge_cases/0]). -if(?OTP_RELEASE >= 29). --export([otp29/0]). +-export([otp29/1]). -otp29() -> +otp29(Input) -> #{ - multi_value => [1, 2, 3 || true], - comp_asssign => [X, Y || X = 1, Y = 2] + multi_value => [1, X, 3 || X <- Input], + zipping => [X, Y || X <- Input && Y <- Input], + comp_asssign => [X, Y || _ <- Input, X = 1, Y = 2] }. -endif. diff --git a/test/examples/pass_prefer_strict_generators.erl b/test/examples/pass_prefer_strict_generators.erl index 3632bb2e..e111686d 100644 --- a/test/examples/pass_prefer_strict_generators.erl +++ b/test/examples/pass_prefer_strict_generators.erl @@ -1,9 +1,24 @@ -module(pass_prefer_strict_generators). +-if(?OTP_RELEASE >= 29). +-feature(compr_assign, enable). +-endif. + -if(?OTP_RELEASE >= 28). -export([bitstrings/1, lists/1, maps/1, edge_cases/0]). +-if(?OTP_RELEASE >= 29). +-export([otp29/1]). + +otp29(Input) -> + #{ + multi_value => [1, X, 3 || X <:- Input], + zipping => [X, Y || X <:- Input && Y <:- Input], + comp_asssign => [X, Y || X = 1, Y = 2] + }. +-endif. + bitstrings(Input) -> { <<<> || <> <:= Input>>, diff --git a/test/style_SUITE.erl b/test/style_SUITE.erl index 009f47b7..26f618a2 100644 --- a/test/style_SUITE.erl +++ b/test/style_SUITE.erl @@ -1341,26 +1341,51 @@ verify_prefer_strict_generators(Config) -> case {string:to_integer(erlang:system_info(otp_release)), Group} of {{R, _}, _} when R < 28 -> [] = Warnings; - {_, beam_files} -> + {{28, _}, beam_files} -> [_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _] = Warnings; - {_, _} -> + {{28, _}, _} -> [ - #{line_num := 21}, #{line_num := 22}, #{line_num := 23}, - #{line_num := 23}, - #{line_num := 28}, + #{line_num := 24}, + #{line_num := 24}, #{line_num := 29}, #{line_num := 30}, - #{line_num := 30}, - #{line_num := 35}, + #{line_num := 31}, + #{line_num := 31}, #{line_num := 36}, #{line_num := 37}, + #{line_num := 38}, + #{line_num := 38}, + #{line_num := 44}, + #{line_num := 47}, + #{line_num := 47}, + #{line_num := 48} + ] = Warnings; + {_, beam_files} -> + [_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _] = Warnings; + {_, _} -> + [ + #{line_num := 14}, + #{line_num := 15}, + #{line_num := 15}, + #{line_num := 16}, + #{line_num := 22}, + #{line_num := 23}, + #{line_num := 24}, + #{line_num := 24}, + #{line_num := 29}, + #{line_num := 30}, + #{line_num := 31}, + #{line_num := 31}, + #{line_num := 36}, #{line_num := 37}, - #{line_num := 43}, - #{line_num := 46}, - #{line_num := 46}, - #{line_num := 47} + #{line_num := 38}, + #{line_num := 38}, + #{line_num := 44}, + #{line_num := 47}, + #{line_num := 47}, + #{line_num := 48} ] = Warnings end,