Skip to content

Commit b42bb2c

Browse files
committed
Two tests that the typechecker correctly unifies type arguments in patterns with their expected tag types
1 parent 971b5d5 commit b42bb2c

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// -*- rust -*-
2+
// xfail-stage0
3+
4+
use std;
5+
import std::option;
6+
import std::option::some;
7+
8+
// error-pattern: mismatched types
9+
10+
tag bar {
11+
t1((), option::t[vec[int]]);
12+
t2;
13+
}
14+
15+
fn foo(bar t) -> int {
16+
alt (t) {
17+
case (t1(_, some(?x))) {
18+
ret (x * 3);
19+
}
20+
case (_) {
21+
fail;
22+
}
23+
}
24+
}
25+
26+
fn main() {
27+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// -*- rust -*-
2+
use std;
3+
import std::option;
4+
import std::option::some;
5+
6+
// error-pattern: mismatched types
7+
8+
tag bar {
9+
t1((), option::t[vec[int]]);
10+
t2;
11+
}
12+
13+
fn foo(bar t) {
14+
alt (t) {
15+
case (t1(_, some[int](?x))) {
16+
log x;
17+
}
18+
case (_) {
19+
fail;
20+
}
21+
}
22+
}
23+
24+
fn main() {
25+
}

0 commit comments

Comments
 (0)