aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Rohrer <[email protected]>2016-10-04 17:10:40 -0400
committerGitHub <[email protected]>2016-10-04 17:10:40 -0400
commit33296501241d80df3dec8ee422bf8743558258af (patch)
tree3f2ef88c2f0f67d9333a8ea05805a131f3c28c74
parent634d26929bb5852958870a7b18f67b4b8702bfa2 (diff)
downloadotp-33296501241d80df3dec8ee422bf8743558258af.tar.gz
otp-33296501241d80df3dec8ee422bf8743558258af.tar.bz2
otp-33296501241d80df3dec8ee422bf8743558258af.zip
Fix reference to automatic `undefined` field declared types.
In 8ce35b287fb50a6845fccf6a13c672aae303dc91 automatic insertion of `undefined` for record fields without initializers was removed, but this was not noted in the documentation. Add a warning about this change using similar verbiage as the original docs.
-rw-r--r--system/doc/reference_manual/typespec.xml15
1 files changed, 9 insertions, 6 deletions
diff --git a/system/doc/reference_manual/typespec.xml b/system/doc/reference_manual/typespec.xml
index 1899efd5f3..4421529dda 100644
--- a/system/doc/reference_manual/typespec.xml
+++ b/system/doc/reference_manual/typespec.xml
@@ -409,11 +409,13 @@
The initial values for fields are to be compatible
with (that is, a member of) the corresponding types.
This is checked by the compiler and results in a compilation error
- if a violation is detected. For fields without initial values,
- the singleton type <c>'undefined'</c> is added to all declared types.
- In other words, the following two record declarations have identical
- effects:
+ if a violation is detected.
</p>
+ <warning>
+ <p>In previous (pre-19) versions of Erlang, for fields without initial values,
+ the singleton type <c>'undefined'</c> was added to all declared types.
+ In other words, the following two record declarations had identical
+ effects:</p>
<pre>
-record(rec, {f1 = 42 :: integer(),
f2 :: float(),
@@ -423,9 +425,10 @@
f2 :: 'undefined' | float(),
f3 :: 'undefined' | 'a' | 'b'}).</pre>
<p>
- For this reason, it is recommended that records contain initializers,
- whenever possible.
+ This is no longer the case. If you require <c>'undefined'</c> in your record field
+ type, you must explicitly add it to the typespec, as in the 2nd example.
</p>
+ </warning>
<p>
Any record, containing type information or not, once defined,
can be used as a type using the following syntax: