From 8784fdc88e32979ee2186500735ff4ada6190e15 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sun, 3 Feb 2013 02:48:04 +0100 Subject: Forbid multiple values in Core Erlang sequence arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It does not make sense to return multiple values from a sequence argument and the Kernel Erlang passes can't cope with it. The linting pass now knows how to detect this kind of defunct code and the Core code folding pass is changed to not generate code like that when optimizing away multiple-valued lets in effect mode. Reported-by: José Valim --- lib/compiler/src/sys_core_fold.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/compiler/src/sys_core_fold.erl') diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index d5fec0c869..c35eef58de 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -132,7 +132,12 @@ body(Body, Sub) -> body(#c_values{anno=A,es=Es0}, Ctxt, Sub) -> Es1 = expr_list(Es0, Ctxt, Sub), - #c_values{anno=A,es=Es1}; + case Ctxt of + value -> + #c_values{anno=A,es=Es1}; + effect -> + make_effect_seq(Es1, Sub) + end; body(E, Ctxt, Sub) -> ?ASSERT(verify_scope(E, Sub)), expr(E, Ctxt, Sub). -- cgit v1.2.3