diff --git a/lib/dialyzer/src/erl_types.erl b/lib/dialyzer/src/erl_types.erl index 2588e7aa240d..fb533cf046a4 100644 --- a/lib/dialyzer/src/erl_types.erl +++ b/lib/dialyzer/src/erl_types.erl @@ -2148,6 +2148,8 @@ t_sup_aux(?nominal(LHS_Name, ?nominal(LHS_InnerName, _)=LHS_Inner)=LHS, ?nominal(RHS_Name, Sup); ?nominal(RHS_InnerName = LHS_Name, _)=Sup -> ?nominal(LHS_Name, Sup); + ?nominal(_,_)=Sup -> + Sup; ?nominal_set(_, ?none) when LHS_Name < RHS_Name -> ?nominal_set([LHS, RHS], ?none); ?nominal_set(_, ?none) -> diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/union/union_nested_nominal.erl b/lib/dialyzer/test/opaque_SUITE_data/src/union/union_nested_nominal.erl new file mode 100644 index 000000000000..2a1844e35495 --- /dev/null +++ b/lib/dialyzer/test/opaque_SUITE_data/src/union/union_nested_nominal.erl @@ -0,0 +1,26 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2024. 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% + +-module(nested_nominal). +-nominal i1() :: i2() | integer(). +-opaque i2() :: i3(). +-nominal i3() :: {i1() | i2()}. +-export_type([i2/0]). + +%% Expected: should not crash \ No newline at end of file