diff options
author | Hans Bolinder <[email protected]> | 2012-08-22 15:59:55 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2012-08-22 15:59:55 +0200 |
commit | b429cb093819836bbeb2c071898b6dfdb2dcdada (patch) | |
tree | d4fcb76bd29dfa6a9b17d790cea560e8a241cef7 | |
parent | 17a65ee1d0aaedc0d52b4d3ba97f64f7ec7fcfa4 (diff) | |
download | otp-b429cb093819836bbeb2c071898b6dfdb2dcdada.tar.gz otp-b429cb093819836bbeb2c071898b6dfdb2dcdada.tar.bz2 otp-b429cb093819836bbeb2c071898b6dfdb2dcdada.zip |
Fix an issue with parentheses and separate values of union types
Since EDoc 0.7.7 (R14B02) separate values of union types can be
annotated. However, the parser has hitherto chosen not to add the
necessary parentheses due to backwards compatibility.
From this release on code traversing the output of edoc_parser needs
to take care of parentheses around separate values of union types.
Examples of such code are layout modules and doclet modules.
The following example shows annotated values of a union type:
-type t() :: (Name1 :: atom()) | (Name2 :: integer()).
-rw-r--r-- | lib/edoc/src/edoc_parser.yrl | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/edoc/src/edoc_parser.yrl b/lib/edoc/src/edoc_parser.yrl index 4d6428f75b..d7c1b1c045 100644 --- a/lib/edoc/src/edoc_parser.yrl +++ b/lib/edoc/src/edoc_parser.yrl @@ -100,9 +100,7 @@ ptype -> '[' utype ',' '...' ']' : #t_nonempty_list{type = '$2'}. ptype -> utype_list: if length(element(1, '$1')) == 1 -> %% there must be exactly one utype in the list - hd(element(1, '$1')); - %% Replace last line when releasing next major release: - %% #t_paren{type = hd(element(1, '$1'))}; + #t_paren{type = hd(element(1, '$1'))}; length(element(1, '$1')) == 0 -> return_error(element(2, '$1'), "syntax error before: ')'"); true -> |