source: tests/global-monomorph.cfa @ dafbde8

arm-ehjacob/cs343-translationnew-ast-unique-expr
Last change on this file since dafbde8 was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 10 months 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: 725 bytes
RevLine 
[afe2939]1// Create monomorphic instances of polymorphic types at global scope.
[74cfafb2]2
[fd54fef]3forall(T &)
[74cfafb2]4void poly0(T &) {}
5
[fd54fef]6forall(T & | sized(T))
[74cfafb2]7void poly1(T &) {}
8
[fd54fef]9forall(T)
[74cfafb2]10void poly2(T &) {}
11
12struct wrapper {
13    void (*mono)(int &);
14};
15
16/* These are failing (#193):
17void (*mono0)(int &) = poly0;
18void (*mono1)(int &) = poly1;
19void (*mono2)(int &) = poly2;
20struct wrapper mono0w = { poly0 };
21struct wrapper mono1w = { poly1 };
22struct wrapper mono2w = { poly2 };
23*/
24void (*mono0c)(int &) @= poly0;
25void (*mono1c)(int &) @= poly1;
26void (*mono2c)(int &) @= poly2;
27struct wrapper mono0wc @= { poly0 };
28struct wrapper mono1wc @= { poly1 };
29struct wrapper mono2wc @= { poly2 };
30
31int main(void) {
32        printf("Compilation Successful.\n");
33        return 0;
34}
Note: See TracBrowser for help on using the repository browser.