aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-11-27 14:38:53 +0100
committerHans Bolinder <[email protected]>2016-02-17 12:58:19 +0100
commit4854065a042ec1812705dec6ec420bb395854a3a (patch)
tree8c8148e2971d99775ddeb61f2c267496051c4ddc
parent173b217a37fbb7439857a833d25ea0703e97ea2b (diff)
downloadotp-4854065a042ec1812705dec6ec420bb395854a3a.tar.gz
otp-4854065a042ec1812705dec6ec420bb395854a3a.tar.bz2
otp-4854065a042ec1812705dec6ec420bb395854a3a.zip
stdlib: Update module shell to handle typed record fields
-rw-r--r--lib/stdlib/src/shell.erl8
-rw-r--r--lib/stdlib/test/shell_SUITE.erl4
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index ce1d9eb0ff..82a3a2be4f 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -917,9 +917,9 @@ expand_records(UsedRecords, E0) ->
RecordDefs = [Def || {_Name,Def} <- UsedRecords],
L = erl_anno:new(1),
E = prep_rec(E0),
- Forms = RecordDefs ++ [{function,L,foo,0,[{clause,L,[],[],[E]}]}],
- [{function,L,foo,0,[{clause,L,[],[],[NE]}]}] =
- erl_expand_records:module(Forms, [strict_record_tests]),
+ Forms0 = RecordDefs ++ [{function,L,foo,0,[{clause,L,[],[],[E]}]}],
+ Forms = erl_expand_records:module(Forms0, [strict_record_tests]),
+ {function,L,foo,0,[{clause,L,[],[],[NE]}]} = lists:last(Forms),
prep_rec(NE).
prep_rec({value,_CommandN,_V}=Value) ->
@@ -1081,6 +1081,8 @@ record_fields([{record_field,_,{atom,_,Field}} | Fs]) ->
[Field | record_fields(Fs)];
record_fields([{record_field,_,{atom,_,Field},_} | Fs]) ->
[Field | record_fields(Fs)];
+record_fields([{typed_record_field,Field,_Type} | Fs]) ->
+ record_fields([Field | Fs]);
record_fields([]) ->
[].
diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl
index a9dd6b5817..3fb1a5572d 100644
--- a/lib/stdlib/test/shell_SUITE.erl
+++ b/lib/stdlib/test/shell_SUITE.erl
@@ -393,7 +393,9 @@ records(Config) when is_list(Config) ->
Test = filename:join(?config(priv_dir, Config), "test.erl"),
Contents = <<"-module(test).
- -record(state, {bin, reply, leader}).
+ -record(state, {bin :: binary(),
+ reply = no,
+ leader = some :: atom()}).
-ifdef(test1).
-record(test1, {f}).