about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-01-03 15:50:05 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-01-03 15:50:05 -0800
commit439e28b7510919e2ff69c82acef387d08cd1e947 (patch)
tree71c18208b0761660ce537dff9d8f68ec75c9ee3a
parent72a3667eb30705826a99bfa2b9478c4037589dbc (diff)
downloadrust-439e28b7510919e2ff69c82acef387d08cd1e947.tar.gz
rust-439e28b7510919e2ff69c82acef387d08cd1e947.zip
Add missing ty_constr cases to trans::type_of_inner and ty::fold_ty.
Closes #970
-rw-r--r--src/comp/middle/trans.rs5
-rw-r--r--src/comp/middle/ty.rs6
-rw-r--r--src/test/run-pass/issue-970.rs6
3 files changed, 17 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index d0f16a332a3..709a5e63792 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -208,6 +208,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
       ty::ty_opaque_closure. {
         T_opaque_closure(cx)
       }
+      ty::ty_constr(subt,_) {
+        // FIXME: could be a constraint on ty_fn
+          check non_ty_var(cx, subt);
+          type_of_inner(cx, sp, subt)
+      }
       _ {
         fail "type_of_inner not implemented for this kind of type";
       }
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 1b1eb83c4a2..31c5755c6e0 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -818,6 +818,12 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t {
       ty_param(id, did) {
         alt fld { fm_param(folder) { ty = folder(id, did); } _ {} }
       }
+      ty_constr(subty, cs) {
+          ty = mk_constr(cx, fold_ty(cx, fld, subty), cs);
+      }
+      _ {
+          cx.sess.fatal("Unsupported sort of type in fold_ty");
+      }
     }
 
     // If this is a general type fold, then we need to run it now.
diff --git a/src/test/run-pass/issue-970.rs b/src/test/run-pass/issue-970.rs
new file mode 100644
index 00000000000..a19b6ccbc7b
--- /dev/null
+++ b/src/test/run-pass/issue-970.rs
@@ -0,0 +1,6 @@
+tag maybe_ordered_pair {
+    yes({low: int, high: int} : less_than(*.low, *.high));
+    no;
+}
+pure fn less_than(x: int, y: int) -> bool { ret x < y; }
+fn main() { }