summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/pure2-bugfix-for-ufcs-arguments.cpp2
blob: de09b983de090409edb7ccad3bd368e2f5a4d220 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
print_res: (x: i32) -> i32 = {
  std::cout << x;
  if x == 9 { std::cout << '\n'; }
  return x;
}

t: @struct type = {
  f: (inout this) -> i32 = print_res(0);
  f: (inout this, _) -> i32 = print_res(1);
  f: <_> (inout this) -> i32 = print_res(2);
  f: <_> (inout this, _) -> i32 = print_res(3);
  f: <_, U> (inout this, _, _) -> i32 = print_res(4);
}

f: (_: t) -> i32 = print_res(5);
f: (_: t, _) -> i32 = print_res(6);
f: <_> (_: t) -> i32 = print_res(7);
f: <_> (_: t, _) -> i32 = print_res(8);
f: <_, U> (_: t, _, _) -> i32 = print_res(9);

m: t       = ();
n: const t = ();
a: <_, U> _ == n;

_: i32 = m.f();
_: i32 = m.f(0);
_: i32 = m.f<t>();
_: i32 = m.f<t>(0);
_: i32 = m.f<t, t>(0, 0);
_: i32 = n.f();
_: i32 = n.f(0);
_: i32 = n.f<t>();
_: i32 = n.f<t>(0);
_: i32 = n.f<t, t>(0, 0);
_: i32 = a<t, t>.f<t, t>(0, 0);

main: () = {
  _ = m.f();
  _ = m.f(0);
  _ = m.f<t>();
  _ = m.f<t>(0);
  _ = m.f<t, t>(0, 0);
  _ = n.f();
  _ = n.f(0);
  _ = n.f<t>();
  _ = n.f<t>(0);
  _ = n.f<t, t>(0, 0);
  _ = a<t, t>.f<t, t>(0, 0);

  _ = :(a, f) = { _ = a.f(a).f(); };
  // _ = 0.std::min<int>(0);
  _ = 0.ns::t<0, 0>::f<0>();
}

// _: i32 = 0.std::min<int>(0);
_: i32 = 0.ns::t<0, 0>::f<0>();

ns: namespace = {
t: @struct <T: int, U: int> type = {
  f: <V: int> (_: int) -> i32 = 0;
}
} // namespace ns

A: @struct type = {
  f: (this) = { }
}

B: @struct type = {
  m: A;
  f: (this) = m.f();
}