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:
parent
6edae938b7
commit
80ec48c93d
2 changed files with 15 additions and 4 deletions
|
@ -574,7 +574,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class pp_formatter_cell : public formatter_cell {
|
class pp_formatter_cell : public formatter_cell {
|
||||||
frontend const & m_frontend;
|
frontend m_frontend;
|
||||||
options m_options;
|
options m_options;
|
||||||
unsigned m_indent;
|
unsigned m_indent;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ Author: Leonardo de Moura
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
#include "operator_info.h"
|
#include "operator_info.h"
|
||||||
#include "kernel_exception.h"
|
#include "kernel_exception.h"
|
||||||
|
#include "builtin.h"
|
||||||
#include "pp.h"
|
#include "pp.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
using namespace lean;
|
using namespace lean;
|
||||||
|
@ -57,7 +58,6 @@ static void tst3() {
|
||||||
static void tst4() {
|
static void tst4() {
|
||||||
frontend f;
|
frontend f;
|
||||||
formatter fmt = mk_pp_formatter(f);
|
formatter fmt = mk_pp_formatter(f);
|
||||||
expr Bool = Const("Bool");
|
|
||||||
context c;
|
context c;
|
||||||
c = extend(c, "x", Bool);
|
c = extend(c, "x", Bool);
|
||||||
c = extend(c, "y", Bool);
|
c = extend(c, "y", Bool);
|
||||||
|
@ -105,6 +105,16 @@ static void tst6() {
|
||||||
std::cout << fmt(env) << "\n";
|
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() {
|
int main() {
|
||||||
tst1();
|
tst1();
|
||||||
tst2();
|
tst2();
|
||||||
|
@ -112,5 +122,6 @@ int main() {
|
||||||
tst4();
|
tst4();
|
||||||
tst5();
|
tst5();
|
||||||
tst6();
|
tst6();
|
||||||
|
tst7();
|
||||||
return has_violations() ? 1 : 0;
|
return has_violations() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue