Changeset fd54fef for tests/tuple
- Timestamp:
- Jan 19, 2021, 8:44:29 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dafbde8
- Parents:
- 2f47ea4
- Location:
- tests/tuple
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/tuple/tuplePolymorphism.cfa
r2f47ea4 rfd54fef 29 29 // ensure that f is a viable candidate for g, even though its parameter structure does not exactly match 30 30 [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, otypeU | { T f(T, U, U); })31 forall(T, U | { T f(T, U, U); }) 32 32 void g(T x, U y) { f(x, y, y); } 33 33 34 34 // add two triples 35 forall( otypeT | { T ?+?(T, T); })35 forall(T | { T ?+?(T, T); }) 36 36 [T, T, T] ?+?([T, T, T] x, [T, T, T] y) { 37 37 return [x.0+y.0, x.1+y.1, x.2+y.2]; … … 64 64 } 65 65 66 forall( otypeT)66 forall(T) 67 67 [T, T] foo([T, T] y) { 68 68 [T, T] x; -
tests/tuple/tupleVariadic.cfa
r2f47ea4 rfd54fef 19 19 printf("called func(void)\n"); 20 20 } 21 forall( otype T, ttype Params| { void process(T); void func(Params); })21 forall(T, Params... | { void process(T); void func(Params); }) 22 22 void func(T arg1, Params p) { 23 23 process(arg1); … … 92 92 } 93 93 94 forall( otypeT)94 forall(T) 95 95 T * copy(T x) { 96 96 // test calling new inside a polymorphic function … … 98 98 } 99 99 100 forall( ttype T| { void foo(T); }) void bar(T x) {}100 forall(T... | { void foo(T); }) void bar(T x) {} 101 101 void foo(int) {} 102 102
Note: See TracChangeset
for help on using the changeset viewer.