aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/rec-extend.rs
blob: ada02597572ec909de3ff24834f931cefd564db1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- rust -*-

type point = rec(int x, int y);

fn main() {
  let point origin = rec(x=0, y=0);

  let point right = rec(x=origin.x + 10 with origin);
  let point up = rec(y=origin.y + 10 with origin);

  assert (origin.x == 0);
  assert (origin.y == 0);

  assert (right.x == 10);
  assert (right.y == 0);

  assert (up.x == 0);
  assert (up.y == 10);
}