aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
committerBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
commitfa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4 (patch)
tree86f2b4178f0a15e33d300cf648a0b235252b9990 /erts/emulator
parentaf17798534de376505498b86525ab8618753ebf7 (diff)
parent4df233adc5a1d5ab54d3c7419a463ae1ef417c12 (diff)
downloadotp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.gz
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.bz2
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.zip
Merge branch 'nox/eep37/OTP-11537'
* nox/eep37/OTP-11537: Support EEP37 named funs in emacs erlang-mode Document named fun expressions Test named funs Support named funs in the debugger interpreter Update primary bootstrap for named funs in the shell Support named funs in the shell Update primary bootstrap for named funs EEP 37: Funs with names Support non top level letrecs in dialyzer
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/test/binary_SUITE.erl7
-rw-r--r--erts/emulator/test/fun_SUITE.erl10
2 files changed, 16 insertions, 1 deletions
diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl
index a340a805b5..44dbb2c588 100644
--- a/erts/emulator/test/binary_SUITE.erl
+++ b/erts/emulator/test/binary_SUITE.erl
@@ -935,7 +935,7 @@ otp_6817_try_bin(Bin) ->
otp_8117(doc) -> "Some bugs in binary_to_term when 32-bit integers are negative.";
otp_8117(suite) -> [];
otp_8117(Config) when is_list(Config) ->
- [otp_8117_do(Op,-(1 bsl N)) || Op <- ['fun',list,tuple],
+ [otp_8117_do(Op,-(1 bsl N)) || Op <- ['fun',named_fun,list,tuple],
N <- lists:seq(0,31)],
ok.
@@ -944,6 +944,11 @@ otp_8117_do('fun',Neg) ->
FunBin = term_to_binary(fun() -> ok end),
?line <<B1:27/binary,_NumFree:32,Rest/binary>> = FunBin,
?line bad_bin_to_term(<<B1/binary,Neg:32,Rest/binary>>);
+otp_8117_do(named_fun,Neg) ->
+ % Named fun with negative num_free
+ FunBin = term_to_binary(fun F() -> F end),
+ ?line <<B1:27/binary,_NumFree:32,Rest/binary>> = FunBin,
+ ?line bad_bin_to_term(<<B1/binary,Neg:32,Rest/binary>>);
otp_8117_do(list,Neg) ->
%% List with negative length
?line bad_bin_to_term(<<131,104,2,108,Neg:32,97,11,104,1,97,12,97,13,106,97,14>>);
diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl
index 36ba4e0f48..8ad5f290ed 100644
--- a/erts/emulator/test/fun_SUITE.erl
+++ b/erts/emulator/test/fun_SUITE.erl
@@ -262,6 +262,16 @@ equality(Config) when is_list(Config) ->
?line false = eq(FF2, FF4),
?line false = eq(FF3, FF4),
+ %% EEP37
+ H1 = fun Fact(N) when N > 0 -> N * Fact(N - 1); Fact(0) -> 1 end,
+ H2 = fun Pow(N, M) when M > 0 -> N * Pow(N, M - 1); Pow(_, 0) -> 1 end,
+ H1_copy = copy_term(H1),
+
+ true = eq(H1, H1),
+ true = eq(H1, H1_copy),
+ true = eq(H2, H2),
+ false = eq(H1, H2),
+
ok.
eq(X, X) -> true;