aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/generic-tag-values.rs
blob: 46421e0a28c6be5be8e4fae52014ea5dee40b120 (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
// -*- rust -*-

tag noption[T] {
  some(T);
}

fn main() {
  let noption[int] nop = some[int](5);
  alt (nop) {
    case (some[int](?n)) {
      log n;
      assert (n == 5);
    }
  }

  let noption[tup(int, int)] nop2 = some[tup(int, int)](tup(17, 42));
  alt (nop2) {
    case (some[tup(int, int)](?t)) {
      log t._0;
      log t._1;
      assert (t._0 == 17);
      assert (t._1 == 42);
    }
  }
}