fix(library/compiler/lcnf): apply_beta takes arguments in reverse order

This commit is contained in:
Leonardo de Moura 2018-09-11 17:55:06 -07:00
parent 3ba777e709
commit 72e99ea3ee

View file

@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include <algorithm>
#include "runtime/flet.h"
#include "kernel/type_checker.h"
#include "kernel/instantiate.h"
@ -69,9 +70,10 @@ public:
return m_lctx.mk_lambda(args, mk_app(e, args));
}
expr visit_projection(expr const & fn, buffer<expr> const & args, bool root) {
expr visit_projection(expr const & fn, buffer<expr> & args, bool root) {
constant_info info = m_env.get(const_name(fn));
expr fn_val = instantiate_value_lparams(info, const_levels(fn));
std::reverse(args.begin(), args.end());
return visit(apply_beta(fn_val, args.size(), args.data()), root);
}