Skip to content

Commit 26e1cac

Browse files
committed
Let typestate constraints mention pattern-bound vars
1 parent b099760 commit 26e1cac

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/comp/middle/tstate/auxiliary.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,18 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: &@expr) -> @constr_arg_use {
621621
carg_ident({ident: p.node.idents[0],
622622
node: a_id.node}));
623623
}
624-
_ {
624+
some (def_binding(b_id)) {
625+
ret @respan(p.span,
626+
carg_ident({ident: p.node.idents[0],
627+
node: b_id.node}));
628+
}
629+
some(_) {
625630
tcx.sess.bug("exprs_to_constr_args: non-local variable " +
626631
"as pred arg");
632+
}
633+
none {
634+
tcx.sess.bug("exprs_to_constr_args: NONE " +
635+
"as pred arg");
627636

628637
}
629638
}
@@ -646,10 +655,6 @@ fn exprs_to_constr_args(tcx: ty::ctxt, args: &[@expr]) -> [@constr_arg_use] {
646655

647656
fn expr_to_constr(tcx: ty::ctxt, e: &@expr) -> sp_constr {
648657
alt e.node {
649-
650-
651-
// FIXME change the first pattern to expr_path to test a
652-
// typechecker bug
653658
expr_call(operator, args) {
654659
alt operator.node {
655660
expr_path(p) {

0 commit comments

Comments
 (0)