aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/nested-pattern.rs
blob: c44c96e59e0952d62116c97a0302fb2961fdaed7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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]));
}