From 3d158fba7e3a1d5c7dc7d78cb8a45b0eeb2c90da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 5 May 2023 09:29:07 +0200 Subject: Add uppcoming incompatibility note about unbound type variables --- .../general_info/upcoming_incompatibilities.xml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/system/doc/general_info/upcoming_incompatibilities.xml b/system/doc/general_info/upcoming_incompatibilities.xml index 4d31784f8d..8538067b57 100644 --- a/system/doc/general_info/upcoming_incompatibilities.xml +++ b/system/doc/general_info/upcoming_incompatibilities.xml @@ -155,6 +155,30 @@

We plan to introduce the same warning in OTP 26.1, but by default it will be disabled.

+ +
+ + Singleton type variables will become a compile-time error + +

Before Erlang/OTP 26, the compiler would silenty accept the + following spec:

+ +
+-spec f(Opts) -> term() when
+    Opts :: {ok, Unknown} | {error, Unknown}.
+f(_) -> error.
+ +

In OTP 26, the compiler emits a warning pointing out that the type variable + Unknown is unbound:

+ +
+t.erl:6:18: Warning: type variable 'Unknown' is only used once (is unbound)
+%    6|     Opts :: {ok, Unknown} | {error, Unknown}.
+%     |                  ^
+ +

In OTP 27, that warning will become an error.

+
+
-- cgit v1.2.1