Skip to content

Commit

Permalink
Merge branch 'john/dialyzer/fix-opaque-crash/ERIERL-1183/OTP-19439' i…
Browse files Browse the repository at this point in the history
…nto maint-26

* john/dialyzer/fix-opaque-crash/ERIERL-1183/OTP-19439:
  dialyzer: Fix opaque-related crash
  • Loading branch information
Erlang/OTP committed Jan 26, 2025
2 parents 3ab62c7 + d1e4878 commit af2c808
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/dialyzer/src/erl_types.erl
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ t_decorate_with_opaque(T1, T2, Opaques) ->
end.

decorate(Type, ?none, _Opaques) -> Type;
decorate(Type, ?unit, _Opaques) -> Type;
decorate(?function(Domain, Range), ?function(D, R), Opaques) ->
?function(decorate(Domain, D, Opaques), decorate(Range, R, Opaques));
decorate(?list(Types, Tail, Size), ?list(Ts, Tl, _Sz), Opaques) ->
Expand Down
19 changes: 19 additions & 0 deletions lib/dialyzer/test/opaque_SUITE_data/src/opaque/opaque_bug6.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-module(opaque_bug6).

-export([loop/1]).
-export_type([unused_dummy/0]).

-type other_type() :: opaque_bug6_adt:adt().

%% Required for decorate/3 to be called, jarring the bug loose. Does not need
%% to be used anywhere.
-opaque unused_dummy() :: {pid(), binary()}.

-spec loop(other_type()) -> no_return().
loop(OtherType) ->
receive
_X ->
loop(OtherType)
after timer:minutes(30) ->
opaque_bug6_adt:do(OtherType)
end.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-module(opaque_bug6_adt).
-export([do/1]).

-export_type([adt/0]).
-opaque adt() :: {a, term()}.

-spec do(adt()) -> ok | {error, atom()}.
do({Mod, Arg}) -> Mod:foo(Arg).

0 comments on commit af2c808

Please sign in to comment.