aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-08-21 14:33:13 +0200
committerBjörn Gustavsson <[email protected]>2014-09-01 14:37:15 +0200
commit9b786fc3114723d71383b184c4824d4498a1e6af (patch)
tree0751b28d73f17e18378efc83e35e085b94c6e153 /lib/asn1/src
parentf94cfe594e449799b1e97829483551572bb39f63 (diff)
downloadotp-9b786fc3114723d71383b184c4824d4498a1e6af.tar.gz
otp-9b786fc3114723d71383b184c4824d4498a1e6af.tar.bz2
otp-9b786fc3114723d71383b184c4824d4498a1e6af.zip
Check the formal parameter for parameterized type definitions
Check the formal parameters for a parameterized type definition. If the governor for a formal parameter is absent, the formal parameter must be in upper case.
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1ct_check.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 2055f2e5eb..2e0e4d5977 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -2926,8 +2926,7 @@ get_canonic_type(S,Type,NameList) ->
check_ptype(S,Type,Ts) when is_record(Ts,type) ->
- %Tag = Ts#type.tag,
- %Constr = Ts#type.constraint,
+ check_formal_parameters(S, Type#ptypedef.args),
Def = Ts#type.def,
NewDef=
case Def of
@@ -2953,6 +2952,16 @@ check_ptype(S,Type,Ts) when is_record(Ts,type) ->
check_ptype(_S,_PTDef,Ts) when is_record(Ts,objectclass) ->
throw({asn1_param_class,Ts}).
+check_formal_parameters(S, Args) ->
+ _ = [check_formal_parameter(S, A) || A <- Args],
+ ok.
+
+check_formal_parameter(_, {_,_}) ->
+ ok;
+check_formal_parameter(_, #'Externaltypereference'{}) ->
+ ok;
+check_formal_parameter(S, #'Externalvaluereference'{value=Name}=Ref) ->
+ asn1_error(S, Ref, {illegal_typereference,Name}).
% check_type(S,Type,ObjSpec={{objectclassname,_},_}) ->
% check_class(S,ObjSpec);
@@ -6748,6 +6757,8 @@ format_error({illegal_instance_of,Class}) ->
[Class]);
format_error(illegal_octet_string_value) ->
"expecting a bstring or an hstring as value for an OCTET STRING";
+format_error({illegal_typereference,Name}) ->
+ io_lib:format("'~p' is used as a typereference, but does not start with an uppercase letter", [Name]);
format_error({invalid_fields,Fields,Obj}) ->
io_lib:format("invalid ~s in ~p", [format_fields(Fields),Obj]);
format_error({invalid_bit_number,Bit}) ->