Beginnings of support for constrained types

Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.

Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
This commit is contained in:
Tim Chevalier
2011-07-19 17:52:34 -07:00
parent da2a7e5bd2
commit bd4aeef78b
20 changed files with 606 additions and 366 deletions

View File

@@ -134,8 +134,8 @@ fn compile_input(session::session sess, ast::crate_cfg cfg, str input,
bind resolve::resolve_crate(sess, ast_map, crate));
auto freevars =
time(time_passes, "freevar finding",
bind freevars::annotate_freevars(sess, d._0, crate));
auto ty_cx = ty::mk_ctxt(sess, d._0, d._1, ast_map, freevars);
bind freevars::annotate_freevars(sess, d, crate));
auto ty_cx = ty::mk_ctxt(sess, d, ast_map, freevars);
time[()](time_passes, "typechecking",
bind typeck::check_crate(ty_cx, crate));
if (sess.get_opts().run_typestate) {
@@ -200,8 +200,8 @@ fn pretty_print_input(session::session sess, ast::crate_cfg cfg,
case (ppm_typed) {
auto amap = middle::ast_map::map_crate(*crate);
auto d = resolve::resolve_crate(sess, amap, crate);
auto freevars = freevars::annotate_freevars(sess, d._0, crate);
auto ty_cx = ty::mk_ctxt(sess, d._0, d._1, amap, freevars);
auto freevars = freevars::annotate_freevars(sess, d, crate);
auto ty_cx = ty::mk_ctxt(sess, d, amap, freevars);
typeck::check_crate(ty_cx, crate);
ann = rec(pre=ann_paren_for_expr,
post=bind ann_typed_post(ty_cx, _));