aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-11-27 14:14:07 +0100
committerHans Bolinder <[email protected]>2016-02-17 12:58:19 +0100
commit173b217a37fbb7439857a833d25ea0703e97ea2b (patch)
tree32247369e60192d752de1463e18945923c350bf5 /lib/stdlib
parentde9012628a6b0e97d2f1325bf2f72817f69f84ee (diff)
downloadotp-173b217a37fbb7439857a833d25ea0703e97ea2b.tar.gz
otp-173b217a37fbb7439857a833d25ea0703e97ea2b.tar.bz2
otp-173b217a37fbb7439857a833d25ea0703e97ea2b.zip
stdlib: Update ms_transform to handle typed record fields
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/ms_transform.erl13
-rw-r--r--lib/stdlib/test/ms_transform_SUITE.erl6
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl
index b67b6f75d7..24b5fde1db 100644
--- a/lib/stdlib/src/ms_transform.erl
+++ b/lib/stdlib/src/ms_transform.erl
@@ -307,15 +307,18 @@ cleanup_filename({Old,OldRec,OldWarnings}) ->
add_record_definition({Name,FieldList}) ->
{KeyList,_} = lists:foldl(
- fun({record_field,_,{atom,Line0,FieldName}},{L,C}) ->
- {[{FieldName,C,{atom,Line0,undefined}}|L],C+1};
- ({record_field,_,{atom,_,FieldName},Def},{L,C}) ->
- {[{FieldName,C,Def}|L],C+1}
- end,
+ fun(F, {L,C}) -> {[record_field(F, C)|L],C+1} end,
{[],2},
FieldList),
put_records([{Name,KeyList}|get_records()]).
+record_field({record_field,_,{atom,Line0,FieldName}}, C) ->
+ {FieldName,C,{atom,Line0,undefined}};
+record_field({record_field,_,{atom,_,FieldName},Def}, C) ->
+ {FieldName,C,Def};
+record_field({typed_record_field,Field,_Type}, C) ->
+ record_field(Field, C).
+
forms([F0|Fs0]) ->
F1 = form(F0),
Fs1 = forms(Fs0),
diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl
index f02e82b39c..5f2167b609 100644
--- a/lib/stdlib/test/ms_transform_SUITE.erl
+++ b/lib/stdlib/test/ms_transform_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -342,8 +342,8 @@ records(doc) ->
records(Config) when is_list(Config) ->
?line setup(Config),
?line RD = <<"-record(t, {"
- "t1 = [],"
- "t2 = foo,"
+ "t1 = [] :: list(),"
+ "t2 = foo :: atom(),"
"t3,"
"t4"
"}).">>,