Skip to content

Commit 564283d

Browse files
authored
Discontinue support for 20.x (#292)
* Remove support for versions without OTP_RELEASE macro * Remove STACKTRACE as a macro
1 parent 9f9f18a commit 564283d

File tree

7 files changed

+23
-46
lines changed

7 files changed

+23
-46
lines changed

.github/workflows/ci.yml

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929
- "22.1" # 22.0 seg faults
3030
- "21.3"
3131
- "21.0"
32-
- "20.3"
33-
- "20.0"
3432
steps:
3533
- name: Checkout code
3634
uses: actions/checkout@v2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ incompatibilities between the two tools by now.
195195
<!-- Badges (alphabetically) -->
196196
[codecov badge]: https://codecov.io/gh/proper-testing/proper/branch/master/graph/badge.svg
197197
[commit badge]: https://img.shields.io/github/last-commit/proper-testing/proper.svg?style=flat-square
198-
[erlang versions badge]: https://img.shields.io/badge/erlang-20.0%20to%2025.0-blue.svg?style=flat-square
198+
[erlang versions badge]: https://img.shields.io/badge/erlang-21.0%20to%2025.0-blue.svg?style=flat-square
199199
[hex pm badge]: https://img.shields.io/hexpm/v/proper.svg?style=flat
200200
[license badge]: https://img.shields.io/github/license/proper-testing/proper.svg?style=flat-square
201201
[release badge]: https://img.shields.io/github/release/proper-testing/proper.svg?style=flat-square

include/proper_internal.hrl

+4-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
%%% -*- coding: utf-8 -*-
2-
%%% -*- erlang-indent-level: 2 -*-
1+
%%% -*- coding: utf-8; erlang-indent-level: 2 -*-
32
%%% -------------------------------------------------------------------
4-
%%% Copyright 2010-2020 Manolis Papadakis <[email protected]>,
3+
%%% Copyright 2010-2022 Manolis Papadakis <[email protected]>,
54
%%% Eirini Arvaniti <[email protected]>
65
%%% and Kostis Sagonas <[email protected]>
76
%%%
@@ -20,9 +19,9 @@
2019
%%% You should have received a copy of the GNU General Public License
2120
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2221

23-
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
22+
%%% @copyright 2010-2022 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
2423
%%% @version {@version}
25-
%%% @author Manolis Papadakis
24+
%%% @author Manolis Papadakis and Kostis Sagonas
2625
%%% @doc Internal header file: This header is included in all PropEr source
2726
%%% files.
2827

@@ -42,20 +41,6 @@
4241

4342
-define(anno(L), erl_anno:new(L)).
4443

45-
%%------------------------------------------------------------------------------
46-
%% Stacktrace access
47-
%%------------------------------------------------------------------------------
48-
49-
-ifndef(OTP_RELEASE). %% introduced in 21
50-
%% cases for Erlang/OTP releases prior to 21
51-
-define(STACKTRACE(ErrorType, Error, ErrorStackTrace),
52-
ErrorType:Error ->
53-
ErrorStackTrace = erlang:get_stacktrace(),).
54-
-else. %% -if (?OTP_RELEASE >= 21).
55-
-define(STACKTRACE(ErrorType, Error, ErrorStackTrace),
56-
ErrorType:Error:ErrorStackTrace ->).
57-
-endif.
58-
5944
%%------------------------------------------------------------------------------
6045
%% Macros
6146
%%------------------------------------------------------------------------------
@@ -89,15 +74,11 @@
8974
-type abs_expr() :: erl_parse:abstract_expr().
9075
-type abs_clause() :: erl_parse:abstract_clause().
9176
-type abs_type() :: erl_parse:abstract_type().
92-
-ifdef(OTP_RELEASE).
9377
-if (?OTP_RELEASE >= 23).
9478
-type abs_rec_field() :: erl_parse:af_field_decl().
9579
-else.
9680
-type abs_rec_field() :: term().
9781
-endif.
98-
-else. % for Erlang/OTP versions prior to 21.0
99-
-type abs_rec_field() :: term().
100-
-endif.
10182

10283
-type loose_tuple(T) :: {} | {T} | {T,T} | {T,T,T} | {T,T,T,T} | {T,T,T,T,T}
10384
| {T,T,T,T,T,T} | {T,T,T,T,T,T,T} | {T,T,T,T,T,T,T,T}

rebar.config

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
%%% Author(s): Manolis Papadakis and Kostis Sagonas
2323
%%% Description: Options for rebar/rebar3
2424

25-
{minimum_otp_vsn, "20.0"}.
25+
{minimum_otp_vsn, "21.0"}.
2626

2727
{erl_first_files, ["src/vararg.erl"]}.
2828

@@ -35,8 +35,7 @@
3535
report_warnings, {warn_format,1},
3636
warn_export_vars, warn_unused_vars,
3737
warn_obsolete_guard, warn_unused_import,
38-
warn_missing_spec, warn_untyped_record,
39-
{platform_define, "^2", 'AT_LEAST_20'}]}.
38+
warn_missing_spec, warn_untyped_record]}.
4039

4140
{profiles,
4241
[{test,

src/proper.erl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%%% -*- coding: utf-8; erlang-indent-level: 2 -*-
22
%%% -------------------------------------------------------------------
3-
%%% Copyright 2010-2021 Manolis Papadakis <[email protected]>,
3+
%%% Copyright 2010-2022 Manolis Papadakis <[email protected]>,
44
%%% Eirini Arvaniti <[email protected]>,
55
%%% Kostis Sagonas <[email protected]>,
66
%%% and Andreas Löscher <[email protected]>
@@ -20,7 +20,7 @@
2020
%%% You should have received a copy of the GNU General Public License
2121
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2222

23-
%%% @copyright 2010-2021 Manolis Papadakis, Eirini Arvaniti, Kostis Sagonas and Andreas Löscher
23+
%%% @copyright 2010-2022 Manolis Papadakis, Eirini Arvaniti, Kostis Sagonas and Andreas Löscher
2424
%%% @version {@version}
2525
%%% @author Manolis Papadakis
2626

@@ -1834,7 +1834,7 @@ apply_args(Args, Prop, Ctx, Opts) ->
18341834
try apply(Prop, Args) of
18351835
InnerProp -> run(InnerProp, Ctx, Opts)
18361836
catch
1837-
?STACKTRACE(error, ErrReason, RawTrace) %, is in macro
1837+
error:ErrReason:RawTrace ->
18381838
case ErrReason =:= function_clause
18391839
andalso threw_exception(Prop, RawTrace) of
18401840
true ->
@@ -1849,7 +1849,7 @@ apply_args(Args, Prop, Ctx, Opts) ->
18491849
{error, {cant_generate,MFAs}};
18501850
throw:{'$typeserver',SubReason} ->
18511851
{error, {typeserver,SubReason}};
1852-
?STACKTRACE(ExcKind, ExcReason, Trace) %, is in macro
1852+
ExcKind:ExcReason:Trace ->
18531853
create_fail_result(Ctx, {exception,ExcKind,ExcReason,Trace})
18541854
end.
18551855

src/proper_statem.erl

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%%% -*- coding: utf-8; erlang-indent-level: 2 -*-
22
%%% -------------------------------------------------------------------
3-
%%% Copyright 2010-2021 Manolis Papadakis <[email protected]>,
3+
%%% Copyright 2010-2022 Manolis Papadakis <[email protected]>,
44
%%% Eirini Arvaniti <[email protected]>,
55
%%% and Kostis Sagonas <[email protected]>
66
%%%
@@ -19,7 +19,7 @@
1919
%%% You should have received a copy of the GNU General Public License
2020
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2121

22-
%%% @copyright 2010-2021 Manolis Papadakis, Eirini Arvaniti, and Kostis Sagonas
22+
%%% @copyright 2010-2022 Manolis Papadakis, Eirini Arvaniti, and Kostis Sagonas
2323
%%% @version {@version}
2424
%%% @author Eirini Arvaniti
2525

@@ -677,17 +677,17 @@ run_commands(Cmds, Env, Mod, History, State) ->
677677
check_precondition(Mod, State, Call) ->
678678
try Mod:precondition(State, Call)
679679
catch
680-
?STACKTRACE(Kind, Reason, StackTrace) %, is in macro
681-
{exception, Kind, Reason, StackTrace}
680+
Kind:Reason:StackTrace ->
681+
{exception, Kind, Reason, StackTrace}
682682
end.
683683

684684
-spec check_postcondition(mod_name(), dynamic_state(), symbolic_call(), term()) ->
685685
boolean() | proper:exception().
686686
check_postcondition(Mod, State, Call, Res) ->
687687
try Mod:postcondition(State, Call, Res)
688688
catch
689-
?STACKTRACE(Kind, Reason, StackTrace) %, is in macro
690-
{exception, Kind, Reason, StackTrace}
689+
Kind:Reason:StackTrace ->
690+
{exception, Kind, Reason, StackTrace}
691691
end.
692692

693693
-spec safe_apply(mod_name(), fun_name(), [term()]) ->
@@ -696,8 +696,8 @@ safe_apply(M, F, A) ->
696696
try apply(M, F, A) of
697697
Result -> {ok, Result}
698698
catch
699-
?STACKTRACE(Kind, Reason, StackTrace) %, is in macro
700-
{error, {exception, Kind, Reason, StackTrace}}
699+
Kind:Reason:StackTrace ->
700+
{error, {exception, Kind, Reason, StackTrace}}
701701
end.
702702

703703

src/proper_typeserver.erl

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%%% -*- coding: utf-8; erlang-indent-level: 2 -*-
22
%%% -------------------------------------------------------------------
3-
%%% Copyright 2010-2021 Manolis Papadakis <[email protected]>,
3+
%%% Copyright 2010-2022 Manolis Papadakis <[email protected]>,
44
%%% Eirini Arvaniti <[email protected]>,
55
%%% and Kostis Sagonas <[email protected]>
66
%%%
@@ -19,7 +19,7 @@
1919
%%% You should have received a copy of the GNU General Public License
2020
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2121

22-
%%% @copyright 2010-2021 Manolis Papadakis, Eirini Arvaniti, and Kostis Sagonas
22+
%%% @copyright 2010-2022 Manolis Papadakis, Eirini Arvaniti, and Kostis Sagonas
2323
%%% @version {@version}
2424
%%% @author Manolis Papadakis
2525

@@ -513,9 +513,8 @@ apply_spec_test({Mod,Fun,_Arity}=MFA, {_Domain,Range}, SpecTimeout, FalsePositiv
513513
try apply(Mod, Fun, Args) of
514514
X -> {{ok, X}, none}
515515
catch
516-
?STACKTRACE(X, Y, Trace) %, is in macro
517-
{{X, Y}, Trace}
518-
end,
516+
Class:Reason:Trace -> {{Class, Reason}, Trace}
517+
end,
519518
case Result of
520519
{ok, Z} ->
521520
case ?MODULE:is_instance(Z, Mod, Range) of

0 commit comments

Comments
 (0)