]> git.lizzy.rs Git - rust.git/commitdiff
Visit the type argument in a port expression
authorTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 12 Jul 2011 01:11:16 +0000 (18:11 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 12 Jul 2011 01:12:00 +0000 (18:12 -0700)
This closes #664.

src/comp/syntax/visit.rs
src/test/run-fail/port-type.rs [new file with mode: 0644]

index 470a8e4e38db4cdf07cd7a4557a741587316ddda..9ff8ccb0c117901bedf50eef4ee7fad1124c7363 100644 (file)
@@ -179,6 +179,13 @@ fn visit_ty[E](&@ty t, &E e, &vt[E] v) {
     }
 }
 
+fn visit_ty_opt[E](&option::t[@ty] ot, &E e, &vt[E] v) {
+    alt (ot) {
+        case (none) {}
+        case (some(?t)) { v.visit_ty(t, e, v); }
+    }
+}
+
 fn visit_constr[E](&@constr c, &E e, &vt[E] v) {
     // default
 
@@ -369,7 +376,7 @@ fn visit_expr[E](&@expr ex, &E e, &vt[E] v) {
         case (expr_log(_, ?x)) { v.visit_expr(x, e, v); }
         case (expr_check(_, ?x)) { v.visit_expr(x, e, v); }
         case (expr_assert(?x)) { v.visit_expr(x, e, v); }
-        case (expr_port(_)) { }
+        case (expr_port(?t)) { visit_ty_opt(t, e, v); }
         case (expr_chan(?x)) { v.visit_expr(x, e, v); }
         case (expr_anon_obj(?anon_obj, _)) {
             alt (anon_obj.fields) {
diff --git a/src/test/run-fail/port-type.rs b/src/test/run-fail/port-type.rs
new file mode 100644 (file)
index 0000000..6f962a7
--- /dev/null
@@ -0,0 +1,16 @@
+// xfail-stage0
+// error-pattern:meep
+fn echo[T](chan[T] c, chan[chan[T]] oc) {
+  // Tests that the type argument in port gets
+  // visited
+        auto p = port[T]();
+        oc <| chan(p);
+
+        auto x;
+        p |> x;
+        c <| x;
+}
+
+fn main() {
+  fail "meep";
+}
\ No newline at end of file