source: tests/errors/completeType.cfa @ 50e04cc

Last change on this file since 50e04cc was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • Property mode set to 100644
File size: 681 bytes
Line 
1void foo(int *) {}
2void bar(void *) {}
3forall(T) void baz(T *);
4forall(T &) void qux(T *);
5forall(T & | sized(T)) void quux(T *);
6
7struct A;       // incomplete
8struct B {};    // complete
9
10int main() {
11        int * i;
12        void * v;
13
14        A * x;
15        A * y;
16        B * x;
17        B * z;
18
19        // okay
20        *i;
21        *y;
22        *z;
23        foo(i);
24        bar(i);
25        baz(i);
26        qux(i);
27        quux(i);
28
29        bar(v);
30        qux(v);
31
32        // bad
33        *v;
34        *x;     // ambiguous
35        foo(v);
36        baz(v);
37        quux(v);
38}
39
40
41forall(T)
42void baz(T * x) {
43        // okay
44        bar(x);
45        baz(x);
46        qux(x);
47        quux(x);
48        *x;
49}
50
51forall(T &)
52void qux(T * y) {
53        // okay
54        *y;
55        bar(y);
56        qux(y);
57
58        // bad
59        baz(y);
60        quux(y);
61}
62
63forall(T & | sized(T))
64void quux(T * z) {
65        // okay
66        bar(z);
67        qux(z);
68        quux(z);
69        *z;
70
71        // bad
72        baz(z);
73}
Note: See TracBrowser for help on using the repository browser.