Make sure formatter can be used even when associated frontend is not in scope.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-08-17 12:33:19 -07:00
parent 6edae938b7
commit 80ec48c93d
2 changed files with 15 additions and 4 deletions

View file

@ -574,7 +574,7 @@ public:
};
class pp_formatter_cell : public formatter_cell {
frontend const & m_frontend;
frontend m_frontend;
options m_options;
unsigned m_indent;

View file

@ -8,6 +8,7 @@ Author: Leonardo de Moura
#include "environment.h"
#include "operator_info.h"
#include "kernel_exception.h"
#include "builtin.h"
#include "pp.h"
#include "test.h"
using namespace lean;
@ -57,7 +58,6 @@ static void tst3() {
static void tst4() {
frontend f;
formatter fmt = mk_pp_formatter(f);
expr Bool = Const("Bool");
context c;
c = extend(c, "x", Bool);
c = extend(c, "y", Bool);
@ -105,6 +105,16 @@ static void tst6() {
std::cout << fmt(env) << "\n";
}
static formatter mk() {
frontend f;
return mk_pp_formatter(f);
}
static void tst7() {
formatter fmt = mk();
std::cout << fmt(And(Const("x"), Const("y"))) << "\n";
}
int main() {
tst1();
tst2();
@ -112,5 +122,6 @@ int main() {
tst4();
tst5();
tst6();
tst7();
return has_violations() ? 1 : 0;
}