diff --git a/lib/dialyzer/src/dialyzer.hrl b/lib/dialyzer/src/dialyzer.hrl index 9be81f49cacd..f492de76dc6d 100644 --- a/lib/dialyzer/src/dialyzer.hrl +++ b/lib/dialyzer/src/dialyzer.hrl @@ -67,7 +67,7 @@ -define(WARN_RETURN_ONLY_EXIT, warn_return_only_exit). -define(WARN_UNDEFINED_CALLBACK, warn_undefined_callbacks). -define(WARN_UNKNOWN, warn_unknown). --define(WARN_UNMATCHED_RETURN, warn_umatched_return). +-define(WARN_UNMATCHED_RETURN, warn_unmatched_return). %% %% The following type has double role: diff --git a/lib/dialyzer/test/abstract_SUITE.erl b/lib/dialyzer/test/abstract_SUITE.erl index 9962148b09ce..b576375583aa 100644 --- a/lib/dialyzer/test/abstract_SUITE.erl +++ b/lib/dialyzer/test/abstract_SUITE.erl @@ -1,3 +1,25 @@ +%% +%% %CopyrightBegin% +%% +%% SPDX-License-Identifier: Apache-2.0 +%% +%% Copyright Ericsson AB 2016-2026. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%% + %% This suite contains cases that cannot be written %% in Erlang itself and must be done via the abstract %% format. @@ -8,12 +30,12 @@ -include("dialyzer_test_constants.hrl"). -export([suite/0, all/0, init_per_suite/0, init_per_suite/1, end_per_suite/1]). --export([generated_case/1]). +-export([generated_case/1, unmatched_return_tag/1]). suite() -> [{timetrap, {minutes, 1}}]. all() -> - [generated_case]. + [generated_case, unmatched_return_tag]. init_per_suite() -> [{timetrap, ?plt_timeout}]. @@ -87,6 +109,21 @@ generated_case(Config) when is_list(Config) -> dialyzer:format_warning(W), ok. +unmatched_return_tag(Config) when is_list(Config) -> + [{warn_unmatched_return, _Loc, {unmatched_return, [_]}}] = + test([{attribute, 1, module, foo}, + {attribute, 2, export, [{a, 0}]}, + {attribute, 3, dialyzer, [unmatched_returns]}, + {function, 4, a, 0, + [{clause, 4, [], [], + [{call, 5, {atom, 5, b}, []}, + {integer, 6, 1}]}]}, + {function, 8, b, 0, + [{clause, 8, [], [], + [{tuple, 9, [{atom, 9, a}, {atom, 9, b}]}]}]}], + Config, [], []), + ok. + test(Prog0, Config, COpts, DOpts) -> Prog = erl_parse:anno_from_term(Prog0), {ok, BeamFile} = compile(Config, Prog, COpts), diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer.hrl b/lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer.hrl index c183c04b4316..6c46483f2cb6 100644 --- a/lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer.hrl +++ b/lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer.hrl @@ -48,7 +48,7 @@ -define(WARN_CONTRACT_SUPERTYPE, warn_contract_supertype). -define(WARN_CONTRACT_RANGE, warn_contract_range). -define(WARN_CALLGRAPH, warn_callgraph). --define(WARN_UNMATCHED_RETURN, warn_umatched_return). +-define(WARN_UNMATCHED_RETURN, warn_unmatched_return). -define(WARN_RACE_CONDITION, warn_race_condition). -define(WARN_BEHAVIOUR, warn_behaviour). -define(WARN_UNDEFINED_CALLBACK, warn_undefined_callbacks).