From b429cb093819836bbeb2c071898b6dfdb2dcdada Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Wed, 22 Aug 2012 15:59:55 +0200 Subject: 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()). --- lib/edoc/src/edoc_parser.yrl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/edoc') 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 -> -- cgit v1.2.3