Skip to content

Commit 1870e97

Browse files
committed
Visit the type argument in a port expression
This closes #664.
1 parent e45819a commit 1870e97

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/comp/syntax/visit.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ fn visit_ty[E](&@ty t, &E e, &vt[E] v) {
179179
}
180180
}
181181

182+
fn visit_ty_opt[E](&option::t[@ty] ot, &E e, &vt[E] v) {
183+
alt (ot) {
184+
case (none) {}
185+
case (some(?t)) { v.visit_ty(t, e, v); }
186+
}
187+
}
188+
182189
fn visit_constr[E](&@constr c, &E e, &vt[E] v) {
183190
// default
184191

@@ -369,7 +376,7 @@ fn visit_expr[E](&@expr ex, &E e, &vt[E] v) {
369376
case (expr_log(_, ?x)) { v.visit_expr(x, e, v); }
370377
case (expr_check(_, ?x)) { v.visit_expr(x, e, v); }
371378
case (expr_assert(?x)) { v.visit_expr(x, e, v); }
372-
case (expr_port(_)) { }
379+
case (expr_port(?t)) { visit_ty_opt(t, e, v); }
373380
case (expr_chan(?x)) { v.visit_expr(x, e, v); }
374381
case (expr_anon_obj(?anon_obj, _)) {
375382
alt (anon_obj.fields) {

src/test/run-fail/port-type.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// xfail-stage0
2+
// error-pattern:meep
3+
fn echo[T](chan[T] c, chan[chan[T]] oc) {
4+
// Tests that the type argument in port gets
5+
// visited
6+
auto p = port[T]();
7+
oc <| chan(p);
8+
9+
auto x;
10+
p |> x;
11+
c <| x;
12+
}
13+
14+
fn main() {
15+
fail "meep";
16+
}

0 commit comments

Comments
 (0)