Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1387-erl_types-Fix-crash-in-contract-checking.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1387-erl_types-Fix-crash-in-contract-checking.patch of Package erlang
From f451b1f7bf581ceba7357dfb8f81384357594d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Mon, 25 Sep 2023 16:41:53 +0200 Subject: [PATCH] erl_types: Fix crash in contract checking --- lib/dialyzer/src/erl_types.erl | 14 ++++++++++---- lib/dialyzer/test/opaque_SUITE_data/results/crash | 1 + .../test/opaque_SUITE_data/src/crash/crash_2.erl | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 lib/dialyzer/test/opaque_SUITE_data/src/crash/crash_2.erl diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 8068baf8e8..647bcd6888 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -559,17 +559,23 @@ t_find_opaque_mismatch(T1, T2, _TopType, Opaques) -> true -> throw(error) end. -t_find_opaque_mismatch_ordlists(L1, L2, TopType, Opaques) -> +t_find_opaque_mismatch_ordlists(L1, L2, TopType, Opaques) + when is_list(L1), is_list(L2) -> List = lists:zipwith(fun(T1, T2) -> t_find_opaque_mismatch(T1, T2, TopType, Opaques) end, L1, L2), - t_find_opaque_mismatch_list(List). + t_find_opaque_mismatch_list(List); +t_find_opaque_mismatch_ordlists(_, _, _TopType, _Opaques) -> + error. -t_find_opaque_mismatch_lists(L1, L2, _TopType, Opaques) -> +t_find_opaque_mismatch_lists(L1, L2, _TopType, Opaques) + when is_list(L1), is_list(L2) -> List = [try t_find_opaque_mismatch(T1, T2, T2, Opaques) catch throw:error -> error end || T1 <- L1, T2 <- L2], - t_find_opaque_mismatch_list(List). + t_find_opaque_mismatch_list(List); +t_find_opaque_mismatch_lists(_, _, _TopType, _Opaques) -> + error. t_find_opaque_mismatch_list([]) -> throw(error); t_find_opaque_mismatch_list([H|T]) -> diff --git a/lib/dialyzer/test/opaque_SUITE_data/results/crash b/lib/dialyzer/test/opaque_SUITE_data/results/crash index 97bc5ea1d6..90279341d5 100644 --- a/lib/dialyzer/test/opaque_SUITE_data/results/crash +++ b/lib/dialyzer/test/opaque_SUITE_data/results/crash @@ -4,3 +4,4 @@ crash_1.erl:48:31: The call crash_1:get_using_branch2(Branch::maybe_improper_lis crash_1.erl:50: The pattern <_Branch, []> can never match the type <maybe_improper_list(),crash_1:target()> crash_1.erl:52: The pattern <Branch, [H = {'target', _, _} | _T]> can never match the type <maybe_improper_list(),crash_1:target()> crash_1.erl:54: The pattern <Branch, [{'target', _, _} | T]> can never match the type <maybe_improper_list(),crash_1:target()> +crash_2.erl:4: The specification for crash_2:crash/0 has an opaque subtype queue:queue(_) which is violated by the success typing () -> {tuple(),queue:queue(_)} diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/crash/crash_2.erl b/lib/dialyzer/test/opaque_SUITE_data/src/crash/crash_2.erl new file mode 100644 index 0000000000..4fb9b009d3 --- /dev/null +++ b/lib/dialyzer/test/opaque_SUITE_data/src/crash/crash_2.erl @@ -0,0 +1,10 @@ +-module(crash_2). +-export([crash/0]). + +-spec crash() -> {tuple(), integer()}. +crash() -> + {tuple(), queue:new()}. + +-spec tuple() -> tuple(). +tuple() -> + ext:ernal(). -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor