Skip to content

Commit 439e28b

Browse files
committed
Add missing ty_constr cases to trans::type_of_inner and ty::fold_ty.
Closes #970
1 parent 72a3667 commit 439e28b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/comp/middle/trans.rs

+5
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
208208
ty::ty_opaque_closure. {
209209
T_opaque_closure(cx)
210210
}
211+
ty::ty_constr(subt,_) {
212+
// FIXME: could be a constraint on ty_fn
213+
check non_ty_var(cx, subt);
214+
type_of_inner(cx, sp, subt)
215+
}
211216
_ {
212217
fail "type_of_inner not implemented for this kind of type";
213218
}

src/comp/middle/ty.rs

+6
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,12 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t {
818818
ty_param(id, did) {
819819
alt fld { fm_param(folder) { ty = folder(id, did); } _ {} }
820820
}
821+
ty_constr(subty, cs) {
822+
ty = mk_constr(cx, fold_ty(cx, fld, subty), cs);
823+
}
824+
_ {
825+
cx.sess.fatal("Unsupported sort of type in fold_ty");
826+
}
821827
}
822828

823829
// If this is a general type fold, then we need to run it now.

src/test/run-pass/issue-970.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tag maybe_ordered_pair {
2+
yes({low: int, high: int} : less_than(*.low, *.high));
3+
no;
4+
}
5+
pure fn less_than(x: int, y: int) -> bool { ret x < y; }
6+
fn main() { }

0 commit comments

Comments
 (0)