diff --git a/infer/tests/codetoanalyze/erlang/nonmatch/issues.exp b/infer/tests/codetoanalyze/erlang/nonmatch/issues.exp index 31b10d1c5..a379e5d01 100644 --- a/infer/tests/codetoanalyze/erlang/nonmatch/issues.exp +++ b/infer/tests/codetoanalyze/erlang/nonmatch/issues.exp @@ -39,6 +39,8 @@ codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple2_Bad/0, 2, NO codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple3_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple4_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple5_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] +codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple6_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] +codetoanalyze/erlang/nonmatch/src/records.erl, test_match_as_tuple7_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] codetoanalyze/erlang/nonmatch/src/records.erl, test_match_field2_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] codetoanalyze/erlang/nonmatch/src/records.erl, test_match_field3_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] codetoanalyze/erlang/nonmatch/src/records.erl, test_match_field4_Bad/0, 2, NO_MATCHING_CASE_CLAUSE, no_bucket, ERROR, [no matching case clause here] @@ -62,3 +64,4 @@ codetoanalyze/erlang/nonmatch/src/tuples.erl, test_nested3_Bad/0, 2, NO_MATCH_OF codetoanalyze/erlang/nonmatch/src/tuples.erl, test_nested4_Bad/0, 2, NO_MATCH_OF_RHS, no_bucket, ERROR, [no match of RHS here] codetoanalyze/erlang/nonmatch/src/tuples.erl, test_size2_Bad/0, -5, NO_MATCHING_FUNCTION_CLAUSE, no_bucket, ERROR, [calling context starts here,in call to `accepts_tuple_of_two/1`,no matching function clause here] codetoanalyze/erlang/nonmatch/src/tuples.erl, test_size3_Bad/0, -8, NO_MATCHING_FUNCTION_CLAUSE, no_bucket, ERROR, [calling context starts here,in call to `accepts_tuple_of_two/1`,no matching function clause here] +codetoanalyze/erlang/nonmatch/src/tuples.erl, test_size4_Bad/0, -11, NO_MATCHING_FUNCTION_CLAUSE, no_bucket, ERROR, [calling context starts here,in call to `accepts_tuple_of_two/1`,no matching function clause here] diff --git a/infer/tests/codetoanalyze/erlang/nonmatch/src/records.erl b/infer/tests/codetoanalyze/erlang/nonmatch/src/records.erl index a0efe5bc7..ad4f4a7e5 100644 --- a/infer/tests/codetoanalyze/erlang/nonmatch/src/records.erl +++ b/infer/tests/codetoanalyze/erlang/nonmatch/src/records.erl @@ -30,6 +30,8 @@ test_match_as_tuple3_Bad/0, test_match_as_tuple4_Bad/0, test_match_as_tuple5_Bad/0, + test_match_as_tuple6_Bad/0, + test_match_as_tuple7_Bad/0, test_bad_record_access_Bad/0, test_bad_record_update_Bad/0, test_nested1_Ok/0, @@ -147,6 +149,18 @@ test_match_as_tuple5_Bad() -> {person, 123, 45, 999999} -> ok end. +test_match_as_tuple6_Bad() -> + P = #person{name = 123, phone = 45, address = 6789}, + case P of + {person, _, _} -> ok + end. + +test_match_as_tuple7_Bad() -> + P = #person{name = 123, phone = 45, address = 6789}, + case P of + {person, _, _, _, _} -> ok + end. + test_bad_record_access_Bad() -> P = #person{name = 123, phone = 45, address = 6789}, P#rabbit.name. diff --git a/infer/tests/codetoanalyze/erlang/nonmatch/src/tuples.erl b/infer/tests/codetoanalyze/erlang/nonmatch/src/tuples.erl index c0c3a3df3..0795c088b 100644 --- a/infer/tests/codetoanalyze/erlang/nonmatch/src/tuples.erl +++ b/infer/tests/codetoanalyze/erlang/nonmatch/src/tuples.erl @@ -9,6 +9,7 @@ test_size1_Ok/0, test_size2_Bad/0, test_size3_Bad/0, + test_size4_Bad/0, test_elements1_Ok/0, test_elements2_Bad/0, test_elements3_Bad/0, @@ -38,6 +39,9 @@ test_size2_Bad() -> test_size3_Bad() -> accepts_tuple_of_two({1}). +test_size4_Bad() -> + accepts_tuple_of_two({}). + test_elements1_Ok() -> T = {1, 2}, {1, 2} = T,