Let typestate constraints mention pattern-bound vars
This commit is contained in:
parent
b099760269
commit
26e1cacb21
1 changed files with 10 additions and 5 deletions
|
@ -621,9 +621,18 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: &@expr) -> @constr_arg_use {
|
||||||
carg_ident({ident: p.node.idents[0],
|
carg_ident({ident: p.node.idents[0],
|
||||||
node: a_id.node}));
|
node: a_id.node}));
|
||||||
}
|
}
|
||||||
_ {
|
some (def_binding(b_id)) {
|
||||||
|
ret @respan(p.span,
|
||||||
|
carg_ident({ident: p.node.idents[0],
|
||||||
|
node: b_id.node}));
|
||||||
|
}
|
||||||
|
some(_) {
|
||||||
tcx.sess.bug("exprs_to_constr_args: non-local variable " +
|
tcx.sess.bug("exprs_to_constr_args: non-local variable " +
|
||||||
"as pred arg");
|
"as pred arg");
|
||||||
|
}
|
||||||
|
none {
|
||||||
|
tcx.sess.bug("exprs_to_constr_args: NONE " +
|
||||||
|
"as pred arg");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,10 +655,6 @@ fn exprs_to_constr_args(tcx: ty::ctxt, args: &[@expr]) -> [@constr_arg_use] {
|
||||||
|
|
||||||
fn expr_to_constr(tcx: ty::ctxt, e: &@expr) -> sp_constr {
|
fn expr_to_constr(tcx: ty::ctxt, e: &@expr) -> sp_constr {
|
||||||
alt e.node {
|
alt e.node {
|
||||||
|
|
||||||
|
|
||||||
// FIXME change the first pattern to expr_path to test a
|
|
||||||
// typechecker bug
|
|
||||||
expr_call(operator, args) {
|
expr_call(operator, args) {
|
||||||
alt operator.node {
|
alt operator.node {
|
||||||
expr_path(p) {
|
expr_path(p) {
|
||||||
|
|
Loading…
Reference in a new issue