diff options
| author | Tim Chevalier <[email protected]> | 2011-04-27 14:55:55 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-04-28 13:26:19 -0700 |
| commit | 844fe207206b6708f2a7e05214857c92c4b7d28b (patch) | |
| tree | 4182419dc16da692ddb0a554d9951e0ce6e99599 /src/test | |
| parent | Slightly more helpful error message for "null lib handle" (diff) | |
| download | rust-844fe207206b6708f2a7e05214857c92c4b7d28b.tar.xz rust-844fe207206b6708f2a7e05214857c92c4b7d28b.zip | |
Fix some nested patterns in rustc
In rustc, nested patterns were potentially matching when they shouldn't
match, because a loop index wasn't being incremented. Fixed it and added
one test case.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/nested-pattern.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs new file mode 100644 index 00000000..e59c2dd5 --- /dev/null +++ b/src/test/run-pass/nested-pattern.rs @@ -0,0 +1,29 @@ +// a bug was causing this to complain about leaked memory on exit + +use std; +import std.option; +import std.option.some; +import std.option.none; + +tag t { + foo(int, uint); + bar(int, option.t[int]); +} + +fn nested(t o) { + + alt (o) { + case (bar(?i, some[int](_))) { + log_err "wrong pattern matched"; + fail; + } + case (_) { + log_err "succeeded"; + } + } + +} + +fn main() { + nested (bar (1, none[int])); +}
\ No newline at end of file |