diff options
author | Hans Bolinder <[email protected]> | 2017-06-26 12:21:53 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-06-26 12:21:53 +0200 |
commit | 693691a8e82e892cab23ee66fe3984a3f98e2aa6 (patch) | |
tree | 6da47c4eb2cb3211703c44646e3c1f73048f24a8 /lib/stdlib/src | |
parent | bd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6 (diff) | |
parent | 55fe5402cedce9d664fea9aaa5928feccaf641be (diff) | |
download | otp-693691a8e82e892cab23ee66fe3984a3f98e2aa6.tar.gz otp-693691a8e82e892cab23ee66fe3984a3f98e2aa6.tar.bz2 otp-693691a8e82e892cab23ee66fe3984a3f98e2aa6.zip |
Merge branch 'isvilen/stdlib/shell_loop/PR-1489/OTP-14488' into maint
* isvilen/stdlib/shell_loop/PR-1489/OTP-14488:
Add test for using typed records in shell
Fix infinite loop in shell caused by record with recursive typespec
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/shell.erl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl index 6eafc7b209..26b3960f4f 100644 --- a/lib/stdlib/src/shell.erl +++ b/lib/stdlib/src/shell.erl @@ -727,7 +727,7 @@ result_will_be_saved() -> used_record_defs(E, RT) -> %% Be careful to return a list where used records come before %% records that use them. The linter wants them ordered that way. - UR = case used_records(E, [], RT) of + UR = case used_records(E, [], RT, []) of [] -> []; L0 -> @@ -737,13 +737,19 @@ used_record_defs(E, RT) -> end, record_defs(RT, UR). -used_records(E, U0, RT) -> +used_records(E, U0, RT, Skip) -> case used_records(E) of {name,Name,E1} -> - U = used_records(ets:lookup(RT, Name), [Name | U0], RT), - used_records(E1, U, RT); + U = case lists:member(Name, Skip) of + true -> + U0; + false -> + R = ets:lookup(RT, Name), + used_records(R, [Name | U0], RT, [Name | Skip]) + end, + used_records(E1, U, RT, Skip); {expr,[E1 | Es]} -> - used_records(Es, used_records(E1, U0, RT), RT); + used_records(Es, used_records(E1, U0, RT, Skip), RT, Skip); _ -> U0 end. |