Two tests that the typechecker correctly unifies type arguments in patterns with their expected tag types

This commit is contained in:
Tim Chevalier 2011-05-14 19:03:08 -07:00
parent 971b5d5151
commit b42bb2cff2
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,27 @@
// -*- rust -*-
// xfail-stage0
use std;
import std::option;
import std::option::some;
// error-pattern: mismatched types
tag bar {
t1((), option::t[vec[int]]);
t2;
}
fn foo(bar t) -> int {
alt (t) {
case (t1(_, some(?x))) {
ret (x * 3);
}
case (_) {
fail;
}
}
}
fn main() {
}

View File

@ -0,0 +1,25 @@
// -*- rust -*-
use std;
import std::option;
import std::option::some;
// error-pattern: mismatched types
tag bar {
t1((), option::t[vec[int]]);
t2;
}
fn foo(bar t) {
alt (t) {
case (t1(_, some[int](?x))) {
log x;
}
case (_) {
fail;
}
}
}
fn main() {
}