Changeset fd54fef for tests/tuple


Ignore:
Timestamp:
Jan 19, 2021, 8:44:29 PM (11 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
dafbde8
Parents:
2f47ea4
Message:

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.

Location:
tests/tuple
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/tuple/tuplePolymorphism.cfa

    r2f47ea4 rfd54fef  
    2929// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
    3030[A] f([A, B] x, B y) { printf("%g %c %g %lld %c %lld %lld %c %lld\n", x.0.[x,y,z], x.1.[x,y,z], y.[x,y,z]); return x.0; }
    31 forall(otype T, otype U | { T f(T, U, U); })
     31forall(T, U | { T f(T, U, U); })
    3232void g(T x, U y) { f(x, y, y); }
    3333
    3434// add two triples
    35 forall(otype T | { T ?+?(T, T); })
     35forall(T | { T ?+?(T, T); })
    3636[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
    3737        return [x.0+y.0, x.1+y.1, x.2+y.2];
     
    6464}
    6565
    66 forall(otype T)
     66forall(T)
    6767[T, T] foo([T, T] y) {
    6868        [T, T] x;
  • tests/tuple/tupleVariadic.cfa

    r2f47ea4 rfd54fef  
    1919        printf("called func(void)\n");
    2020}
    21 forall(otype T, ttype Params | { void process(T); void func(Params); })
     21forall(T, Params... | { void process(T); void func(Params); })
    2222void func(T arg1, Params p) {
    2323        process(arg1);
     
    9292}
    9393
    94 forall(otype T)
     94forall(T)
    9595T * copy(T x) {
    9696        // test calling new inside a polymorphic function
     
    9898}
    9999
    100 forall(ttype T | { void foo(T); }) void bar(T x) {}
     100forall(T... | { void foo(T); }) void bar(T x) {}
    101101void foo(int) {}
    102102
Note: See TracChangeset for help on using the changeset viewer.