aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2016-04-29 10:25:00 +0200
committerHans Bolinder <[email protected]>2016-05-09 08:27:22 +0200
commita73f32b54f5679a2badb48e080203e28f3b40af7 (patch)
treee876a1d5a150881510dd379843151e76463022c1 /lib
parentab950a81bc3361322ce955703f468f314c05e546 (diff)
downloadotp-a73f32b54f5679a2badb48e080203e28f3b40af7.tar.gz
otp-a73f32b54f5679a2badb48e080203e28f3b40af7.tar.bz2
otp-a73f32b54f5679a2badb48e080203e28f3b40af7.zip
syntax_tools: Correct types and specs
Diffstat (limited to 'lib')
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl29
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 8ca4a8e727..5c252dd749 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -5166,7 +5166,7 @@ revert_function_type(Node) ->
%% @see function_type/1
%% @see function_type/2
--spec function_type_arguments(syntaxTree()) -> any_arity | syntaxTree().
+-spec function_type_arguments(syntaxTree()) -> any_arity | [syntaxTree()].
function_type_arguments(Node) ->
case unwrap(Node) of
@@ -5203,33 +5203,34 @@ function_type_return(Node) ->
%% @see constraint_body/1
-record(constraint, {name :: syntaxTree(),
- type :: syntaxTree()}).
+ types :: [syntaxTree()]}).
%% type(Node) = constraint
%% data(Node) = #constraint{name :: Name,
-%% type :: Type}
+%% types :: [Type]}
%%
%% Name = syntaxTree()
%% Type = syntaxTree()
%%
%% `erl_parse' representation:
%%
-%% {type, Pos, constraint, [{atom, Pos, is_subtype}, Name, Type]}
+%% {type, Pos, constraint, [Name, [Var, Type]]}
%%
-%% Name = erl_parse()
+%% Name = {atom, Pos, is_subtype}
+%% Var = erl_parse()
%% Type = erl_parse()
--spec constraint(syntaxTree(), syntaxTree()) -> syntaxTree().
+-spec constraint(syntaxTree(), [syntaxTree()]) -> syntaxTree().
-constraint(Name, Type) ->
+constraint(Name, Types) ->
tree(constraint,
- #constraint{name = Name, type = Type}).
+ #constraint{name = Name, types = Types}).
revert_constraint(Node) ->
Pos = get_pos(Node),
Name = constraint_argument(Node),
- Type = constraint_body(Node),
- {type, Pos, constraint, [Name, Type]}.
+ Types = constraint_body(Node),
+ {type, Pos, constraint, [Name, Types]}.
%% =====================================================================
@@ -5252,14 +5253,14 @@ constraint_argument(Node) ->
%%
%% @see constraint/2
--spec constraint_body(syntaxTree()) -> syntaxTree().
+-spec constraint_body(syntaxTree()) -> [syntaxTree()].
constraint_body(Node) ->
case unwrap(Node) of
- {type, _, constraint, [_, Type]} ->
- Type;
+ {type, _, constraint, [_, Types]} ->
+ Types;
Node1 ->
- (data(Node1))#constraint.type
+ (data(Node1))#constraint.types
end.