Changeset d9fa60a for src/tests


Ignore:
Timestamp:
Nov 16, 2016, 4:37:50 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
186fd86
Parents:
33a7b6d
Message:

moved substituion into MemberExpr? constructor, change generated tuple structs to generic structs, tuples containing type variables almost works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/tupleFunction.c

    r33a7b6d rd9fa60a  
    5151}
    5252
    53 // forall(otype T | { T ?+?(T, T); })
    54 // [T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
    55 //      T x1, x2, x3, y1, y2, y3;
    56 //      [x1, x2, x3] = x;
    57 //      [y1, y2, y3] = y;
    58 //      return [x1+y1, x2+y2, x3+y3];
    59 // }
     53int main() {
     54        [int, double, int] x = [777, 2.76, 8675];
     55        int x1 = 123, x3 = 456;
     56        double x2 = 999.123;
    6057
    61 int main() {
    62   [int, double, int] x = [777, 2.76, 8675];
    63   int x1 = 123, x3 = 456;
    64   double x2 = 999.123;
    65 
    66   printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
     58        printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
    6759
    6860        // call function with tuple parameter using tuple variable arg
     
    9183        [x1, x2, x3] = quux();
    9284        printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3);
     85
     86        // xxx - tuples of type parameters should come out as generic types?
     87        // [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
     88        // ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
     89        // printf("%d %g %d\n", x1, x2, x3);
     90
     91        // xxx - comes out the back as a cast, but should come out as a tuple expression of the first n fields cast to each of the result types
     92        // ([int, double])x;
    9393}
    9494
Note: See TracChangeset for help on using the changeset viewer.