2012-11-13 13:32:49 -08:00
|
|
|
// xfail-test Can't use syntax crate here
|
2012-02-10 11:28:43 -07:00
|
|
|
|
2012-09-11 17:46:20 -07:00
|
|
|
extern mod std;
|
|
|
|
extern mod syntax;
|
2012-02-10 11:28:43 -07:00
|
|
|
|
2012-09-05 12:32:05 -07:00
|
|
|
use io::*;
|
2012-02-10 11:28:43 -07:00
|
|
|
|
2012-09-05 12:32:05 -07:00
|
|
|
use syntax::diagnostic;
|
|
|
|
use syntax::ast;
|
|
|
|
use syntax::codemap;
|
|
|
|
use syntax::parse;
|
|
|
|
use syntax::print::*;
|
2012-02-10 11:28:43 -07:00
|
|
|
|
2012-04-17 23:34:48 -07:00
|
|
|
fn new_parse_sess() -> parse::parse_sess {
|
2012-02-10 11:28:43 -07:00
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2012-07-31 10:27:51 -07:00
|
|
|
trait fake_ext_ctxt {
|
2012-02-10 11:28:43 -07:00
|
|
|
fn session() -> fake_session;
|
|
|
|
}
|
|
|
|
|
|
|
|
type fake_options = {cfg: ast::crate_cfg};
|
|
|
|
|
|
|
|
type fake_session = {opts: @fake_options,
|
2012-04-17 23:34:48 -07:00
|
|
|
parse_sess: parse::parse_sess};
|
2012-02-10 11:28:43 -07:00
|
|
|
|
2012-08-07 18:10:06 -07:00
|
|
|
impl fake_session: fake_ext_ctxt {
|
2012-02-10 11:28:43 -07:00
|
|
|
fn session() -> fake_session {self}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mk_ctxt() -> fake_ext_ctxt {
|
2012-06-29 16:26:56 -07:00
|
|
|
let opts : fake_options = {cfg: ~[]};
|
2012-02-10 11:28:43 -07:00
|
|
|
{opts: @opts, parse_sess: new_parse_sess()} as fake_ext_ctxt
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let ext_cx = mk_ctxt();
|
|
|
|
|
|
|
|
let abc = #ast{23};
|
|
|
|
check_pp(abc, pprust::print_expr, "23");
|
|
|
|
|
2012-06-30 12:23:59 +01:00
|
|
|
let expr3 = #ast{2 - $(abcd) + 7}; //~ ERROR unresolved name: abcd
|
2012-02-10 11:28:43 -07:00
|
|
|
check_pp(expr3, pprust::print_expr, "2 - 23 + 7");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn check_pp<T>(expr: T, f: fn(pprust::ps, T), expect: str) {
|
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|