diff options
| author | Patrick Walton <[email protected]> | 2010-10-14 15:02:35 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-10-14 15:08:19 -0700 |
| commit | c7ab80f743b3e2d34bb702be787507418cc794a8 (patch) | |
| tree | cac4fb19306b207c7fe5397ccc3b419ff53277c7 /src/test/compile-fail | |
| parent | Fix crasher in rustc. (diff) | |
| download | rust-c7ab80f743b3e2d34bb702be787507418cc794a8.tar.xz rust-c7ab80f743b3e2d34bb702be787507418cc794a8.zip | |
Typecheck tags in "alt" patterns
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/alt-tag-nullary.rs | 12 | ||||
| -rw-r--r-- | src/test/compile-fail/alt-tag-unary.rs | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/compile-fail/alt-tag-nullary.rs b/src/test/compile-fail/alt-tag-nullary.rs new file mode 100644 index 00000000..f55f67e9 --- /dev/null +++ b/src/test/compile-fail/alt-tag-nullary.rs @@ -0,0 +1,12 @@ +// error-pattern: mismatched types + +tag a { A; } +tag b { B; } + +fn main() { + let a x = A; + alt (x) { + case (B) {} + } +} + diff --git a/src/test/compile-fail/alt-tag-unary.rs b/src/test/compile-fail/alt-tag-unary.rs new file mode 100644 index 00000000..f2004896 --- /dev/null +++ b/src/test/compile-fail/alt-tag-unary.rs @@ -0,0 +1,12 @@ +// error-pattern: mismatched types + +tag a { A(int); } +tag b { B(int); } + +fn main() { + let a x = A(0); + alt (x) { + case (B(?y)) {} + } +} + |