summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2023-05-05 09:29:07 +0200
committerBjörn Gustavsson <bjorn@erlang.org>2023-05-05 09:42:43 +0200
commit3d158fba7e3a1d5c7dc7d78cb8a45b0eeb2c90da (patch)
treeaaa58a993b9e76e2ade46d3e86f695f022f74a07
parentc6a68a171a299f39a3bd577b085a38f65c7569ae (diff)
downloaderlang-3d158fba7e3a1d5c7dc7d78cb8a45b0eeb2c90da.tar.gz
Add uppcoming incompatibility note about unbound type variables
-rw-r--r--system/doc/general_info/upcoming_incompatibilities.xml24
1 files changed, 24 insertions, 0 deletions
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 @@
<p>We plan to introduce the same warning in OTP 26.1, but by default it
will be disabled.</p>
</section>
+
+ <section>
+ <marker id="singleton_typevars"/>
+ <title>Singleton type variables will become a compile-time error</title>
+
+ <p>Before Erlang/OTP 26, the compiler would silenty accept the
+ following spec:</p>
+
+ <pre>
+-spec f(Opts) -> term() when
+ Opts :: {ok, Unknown} | {error, Unknown}.
+f(_) -> error.</pre>
+
+ <p>In OTP 26, the compiler emits a warning pointing out that the type variable
+ <c>Unknown</c> is unbound:</p>
+
+ <pre>
+t.erl:6:18: Warning: type variable 'Unknown' is only used once (is unbound)
+% 6| Opts :: {ok, Unknown} | {error, Unknown}.
+% | ^</pre>
+
+ <p>In OTP 27, that warning will become an error.</p>
+ </section>
+
</section>
<section>