about summary refs log tree commit diff
path: root/src/test/run-pass/nested-pattern.rs
blob: 3bf982b465e31d08c99d5cb07f6188b96a5d8263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21


// 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])); }