2012-02-10 12:28:43 -06:00
|
|
|
// xfail-pretty
|
|
|
|
|
|
|
|
use std;
|
2012-05-29 23:35:12 -05:00
|
|
|
use syntax;
|
2012-02-10 12:28:43 -06:00
|
|
|
|
2012-03-12 22:04:27 -05:00
|
|
|
import io::*;
|
2012-02-10 12:28:43 -06:00
|
|
|
|
2012-04-24 15:30:00 -05:00
|
|
|
import syntax::diagnostic;
|
|
|
|
import syntax::ast;
|
|
|
|
import syntax::codemap;
|
|
|
|
import syntax::parse;
|
|
|
|
import syntax::print::*;
|
2012-02-10 12:28:43 -06:00
|
|
|
|
2012-04-18 01:34:48 -05:00
|
|
|
fn new_parse_sess() -> parse::parse_sess {
|
2012-02-10 12:28:43 -06:00
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2012-07-31 12:27:51 -05:00
|
|
|
trait fake_ext_ctxt {
|
2012-02-10 12:28:43 -06:00
|
|
|
fn session() -> fake_session;
|
|
|
|
}
|
|
|
|
|
|
|
|
type fake_options = {cfg: ast::crate_cfg};
|
|
|
|
|
|
|
|
type fake_session = {opts: @fake_options,
|
2012-04-18 01:34:48 -05:00
|
|
|
parse_sess: parse::parse_sess};
|
2012-02-10 12:28:43 -06:00
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl fake_session: fake_ext_ctxt {
|
2012-02-10 12:28:43 -06:00
|
|
|
fn session() -> fake_session {self}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mk_ctxt() -> fake_ext_ctxt {
|
2012-06-29 18:26:56 -05:00
|
|
|
let opts : fake_options = {cfg: ~[]};
|
2012-02-10 12:28:43 -06: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 06:23:59 -05:00
|
|
|
let expr3 = #ast{2 - $(abcd) + 7}; //~ ERROR unresolved name: abcd
|
2012-02-10 12:28:43 -06:00
|
|
|
check_pp(expr3, pprust::print_expr, "2 - 23 + 7");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn check_pp<T>(expr: T, f: fn(pprust::ps, T), expect: str) {
|
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|