From fdc7ead670c19468d0450d5909dd96b6e49c22d9 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Fri, 28 Nov 2025 00:14:39 +0100 Subject: [PATCH] Schedule old style type tests for removal in OTP 30 --- lib/stdlib/src/erl_lint.erl | 5 ++- .../general_info/scheduled_for_removal_30.md | 37 ++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index 5bd529e50587..95210a389860 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -393,7 +393,10 @@ format_error_1({removed_type, MNA, String}) -> format_error_1({removed_callback, MNA, String}) -> {~"the callback ~s is removed; ~s", [format_mna(MNA), String]}; format_error_1({obsolete_guard, {F, A}}) -> - {~"~p/~p obsolete (use is_~p/~p)", [F, A, F, A]}; + {~""" + ~p/~p as a type test is obsolete and will be + removed in OTP 30; use is_~p/~p instead. + """, [F, A, F, A]}; format_error_1({obsolete_guard_overridden,Test}) -> {~""" obsolete ~s/1 (meaning is_~s/1) is illegal when there is a diff --git a/system/doc/general_info/scheduled_for_removal_30.md b/system/doc/general_info/scheduled_for_removal_30.md index c8a170d1c985..e974ffd07a02 100644 --- a/system/doc/general_info/scheduled_for_removal_30.md +++ b/system/doc/general_info/scheduled_for_removal_30.md @@ -1,12 +1,39 @@ -SPDX-License-Identifier: Apache-2.0 +### Old aliases for type tests in guards + +The type test aliases `atom/1`, `binary/1`, `float/1`, `function/1`, +`integer/1`, `list/1`, `number/1`, `pid/1`, `port/1`, `record/2`, +`reference/1`, and `tuple/1`, for the respective tests `is_atom/1`, +`is_binary/1`, `is_float/1`, ..., `is_tuple/2`, have been deprecated since +before OTP R13 and have been scheduled for removal in OTP 30. Note that +these aliases could only be used as guard tests at the top level. For +example, in `{X, Y} when float(X), X =:= float(Y) -> ...` the first use of +`float/1` is a type test alias, but the second use is the normal +integer-to-float conversion BIF, because it occurs inside the `=:=`. The +aliases were never recognized outside guards. -Copyright Ericsson AB 2025. All Rights Reserved. -%CopyrightEnd% ---> ### Distribution Control Messages