@@ -524,19 +524,6 @@ defmodule Module.Types.IntegrationTest do
524524 assert_warnings ( files , warnings , consolidate_protocols: true )
525525 end
526526
527- @ tag :require_ast
528- test "String.Chars protocol dispatch on improper lists" do
529- files = % {
530- "a.ex" => """
531- defmodule FooBar do
532- def example1, do: to_string([?a, ?b | "!"])
533- end
534- """
535- }
536-
537- assert_no_warnings ( files , consolidate_protocols: true )
538- end
539-
540527 @ tag :require_ast
541528 test "Enumerable protocol dispatch" do
542529 files = % {
@@ -664,6 +651,40 @@ defmodule Module.Types.IntegrationTest do
664651 after
665652 purge ( A )
666653 end
654+
655+ test "regressions" do
656+ files = % {
657+ # do not emit false positives from defguard
658+ "a.ex" => """
659+ defmodule A do
660+ defguard is_non_nil_arity_function(fun, arity)
661+ when arity != nil and is_function(fun, arity)
662+
663+ def check(fun, args) do
664+ is_non_nil_arity_function(fun, length(args))
665+ end
666+ end
667+ """ ,
668+ # do not parse binary segments as variables
669+ "b.ex" => """
670+ defmodule B do
671+ def decode(byte) do
672+ case byte do
673+ enc when enc in [<<0x00>>, <<0x01>>] -> :ok
674+ end
675+ end
676+ end
677+ """ ,
678+ # String.Chars protocol dispatch on improper lists
679+ "c.ex" => """
680+ defmodule C do
681+ def example, do: to_string([?a, ?b | "!"])
682+ end
683+ """
684+ }
685+
686+ assert_no_warnings ( files , consolidate_protocols: true )
687+ end
667688 end
668689
669690 describe "undefined warnings" do
@@ -1179,41 +1200,6 @@ defmodule Module.Types.IntegrationTest do
11791200 end
11801201 end
11811202
1182- describe "regressions" do
1183- test "does not emit false positives from defguard" do
1184- files = % {
1185- "a.ex" => """
1186- defmodule A do
1187- defguard is_non_nil_arity_function(fun, arity)
1188- when arity != nil and is_function(fun, arity)
1189-
1190- def check(fun, args) do
1191- is_non_nil_arity_function(fun, length(args))
1192- end
1193- end
1194- """
1195- }
1196-
1197- assert_no_warnings ( files )
1198- end
1199-
1200- test "do not parse binary segments as variables" do
1201- files = % {
1202- "a.ex" => """
1203- defmodule A do
1204- def decode(byte) do
1205- case byte do
1206- enc when enc in [<<0x00>>, <<0x01>>] -> :ok
1207- end
1208- end
1209- end
1210- """
1211- }
1212-
1213- assert_no_warnings ( files )
1214- end
1215- end
1216-
12171203 describe "after_verify" do
12181204 test "reports functions" do
12191205 files = % {
0 commit comments