Index: src/tests/.expect/tupleAssign.txt
===================================================================
--- src/tests/.expect/tupleAssign.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,12 +1,0 @@
-u=5 v=6 x=10 y=11 z=[100, 200]
-u=5 v=6 x=10 y=11 z=[100, 200]
-u=11 v=10 x=11 y=10 z=[11, 10]
-u=11 v=10 x=11 y=10 z=[11, 10]
-u=10 v=11 z=[10, 11]
-u=10 v=11 z=[10, 11]
-u=123 v=456 z=[111, 222]
-u=123 v=456 z=[111, 222]
-d=94.12 i=94 c=^ t=[94, 94.12, 94]
-d=94.12 i=94 c=^ t=[94, 94.12, 94]
-d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
-d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
Index: src/tests/.expect/tupleCast.txt
===================================================================
--- src/tests/.expect/tupleCast.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,6 +1,0 @@
-10 A 3.14
-10 A
-10
-10 65
-ran f
-99 F
Index: src/tests/.expect/tupleFunction.txt
===================================================================
--- src/tests/.expect/tupleFunction.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,12 +1,0 @@
-foo([123, 456, 999.123, {321, 654, Q, 3.14}])
-a=123 b=456 c=999.123 d={321, 654, Q, 3.14}
-X=[123, 456, 999.123, {321, 654, Q, 3.14}]
-foo(...)=456
-bar([777, 2.76, 8675])
-bar([123, 999.123, 456])
-baz(777, 2.76, 8675)
-baz(123, 999.123, 456)
-qux([777, 2.76], 8675)
-qux([123, 999.123], 456)
-x=[3, 5.254, 4]
-x1=3 x2=5.254 x3=4
Index: src/tests/.expect/tupleMember.txt
===================================================================
--- src/tests/.expect/tupleMember.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,4 +1,0 @@
-called f!
-g(...)=13.5
-v.[f1, i.[f2, f3], f4]=[12, 11, 13, 3.14159]
-v.[f1, i.[f2, f3], f4]=[4, [987, 2], 6.28]
Index: src/tests/.expect/tuplePolymorphism.txt
===================================================================
--- src/tests/.expect/tuplePolymorphism.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,5 +1,0 @@
-132 1001 459
-132 1001.12 459
-123 999.123 456
-246 1998.25 912
-1.21 x 10.21 1111 v 54385938 1111 v 54385938
Index: src/tests/.expect/tupleVariadic.txt
===================================================================
--- src/tests/.expect/tupleVariadic.txt	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,18 +1,0 @@
-called ?{} with no a
-array = { }
-called ?{} with a: 999
-array = { 999, }
-called ?{} with a: 123 456
-array = { 123, 456, }
-called ?{} with a: 100 200 300
-array = { 100, 200, 300, }
-called ?{} with a: 10 2 3 4
-array = { 10, 2, 3, 4, }
-copy=111111
-calling func
-called process(int) 3
-called process(double) 2
-called process(int) 111
-called process(double) 4.145
-called func(void)
-finished func
Index: src/tests/tuple/.expect/tupleAssign.txt
===================================================================
--- src/tests/tuple/.expect/tupleAssign.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tupleAssign.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,12 @@
+u=5 v=6 x=10 y=11 z=[100, 200]
+u=5 v=6 x=10 y=11 z=[100, 200]
+u=11 v=10 x=11 y=10 z=[11, 10]
+u=11 v=10 x=11 y=10 z=[11, 10]
+u=10 v=11 z=[10, 11]
+u=10 v=11 z=[10, 11]
+u=123 v=456 z=[111, 222]
+u=123 v=456 z=[111, 222]
+d=94.12 i=94 c=^ t=[94, 94.12, 94]
+d=94.12 i=94 c=^ t=[94, 94.12, 94]
+d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
+d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
Index: src/tests/tuple/.expect/tupleCast.txt
===================================================================
--- src/tests/tuple/.expect/tupleCast.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tupleCast.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,6 @@
+10 A 3.14
+10 A
+10
+10 65
+ran f
+99 F
Index: src/tests/tuple/.expect/tupleFunction.txt
===================================================================
--- src/tests/tuple/.expect/tupleFunction.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tupleFunction.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,12 @@
+foo([123, 456, 999.123, {321, 654, Q, 3.14}])
+a=123 b=456 c=999.123 d={321, 654, Q, 3.14}
+X=[123, 456, 999.123, {321, 654, Q, 3.14}]
+foo(...)=456
+bar([777, 2.76, 8675])
+bar([123, 999.123, 456])
+baz(777, 2.76, 8675)
+baz(123, 999.123, 456)
+qux([777, 2.76], 8675)
+qux([123, 999.123], 456)
+x=[3, 5.254, 4]
+x1=3 x2=5.254 x3=4
Index: src/tests/tuple/.expect/tupleMember.txt
===================================================================
--- src/tests/tuple/.expect/tupleMember.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tupleMember.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,4 @@
+called f!
+g(...)=13.5
+v.[f1, i.[f2, f3], f4]=[12, 11, 13, 3.14159]
+v.[f1, i.[f2, f3], f4]=[4, [987, 2], 6.28]
Index: src/tests/tuple/.expect/tuplePolymorphism.txt
===================================================================
--- src/tests/tuple/.expect/tuplePolymorphism.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tuplePolymorphism.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,5 @@
+132 1001 459
+132 1001.12 459
+123 999.123 456
+246 1998.25 912
+1.21 x 10.21 1111 v 54385938 1111 v 54385938
Index: src/tests/tuple/.expect/tupleVariadic.txt
===================================================================
--- src/tests/tuple/.expect/tupleVariadic.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/.expect/tupleVariadic.txt	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,18 @@
+called ?{} with no a
+array = { }
+called ?{} with a: 999
+array = { 999, }
+called ?{} with a: 123 456
+array = { 123, 456, }
+called ?{} with a: 100 200 300
+array = { 100, 200, 300, }
+called ?{} with a: 10 2 3 4
+array = { 10, 2, 3, 4, }
+copy=111111
+calling func
+called process(int) 3
+called process(double) 2
+called process(int) 111
+called process(double) 4.145
+called func(void)
+finished func
Index: src/tests/tuple/tupleAssign.c
===================================================================
--- src/tests/tuple/tupleAssign.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tupleAssign.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,66 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleAssign.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Mon Mar  6 21:23:58 2017
+// Update Count     : 34
+//
+
+#include <fstream>
+
+int main() {
+	{
+		// test multiple assignment and cascading assignment
+		int u = 5, v = 6, x = 10, y = 11;
+		[int, int] z = [100, 200];
+
+		// swap x, y and store the new [x, y] in [u, v] and in z;
+		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
+		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
+		z = [u, v] = [x, y] = [y, x];
+		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
+		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
+
+		// shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
+		[v, z, u] = [z, u, v];
+		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
+		sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
+
+		// multiple assignment with tuple expression on right
+		z = [111, 222];
+		[u, v] = [123, 456];
+		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
+		sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
+	}
+	{
+		// test mass assignment
+		double d = 0.0;
+		int i = 0;
+		char c = '\0';
+		struct X {
+			int z;
+		} x;
+		X ?=?(X & x, double d) {}
+		[int, double, int] t;
+
+		// no conversion from X to integral types, so this serves as a santiy
+		// check that as long as this compiles, ?=?(_, x) is not generated.
+		[t, x, d, i, c, x] = (double)94.12;
+		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
+		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
+		[x, c, i, d, x, t] = (double)-94.12;
+		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
+		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
+	}
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/tests/tuple/tupleCast.c
===================================================================
--- src/tests/tuple/tupleCast.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tupleCast.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,30 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleCast.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Mon Dec 12 15:56:07 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Mon Dec 12 15:56:20 2016
+// Update Count     : 2
+//
+
+[char, int, double] f() { printf("ran f\n"); return ['c', 70, 6.28]; }
+
+int main() {
+  [int, char, float] x = [10, 'A', 3.14f];
+  printf("%d %c %g\n", ([int, char, float])x);
+  printf("%d %c\n", ([int, char])x);
+  printf("%d\n", ([int])x);
+  // printf("%d\n", (int)x);
+  printf("%g %g\n", ([double, float])x);
+  printf("%d %c\n", ([int, char])f());
+}
+
+// Local Variables: //
+// tab-width: 2 //
+// End: //
Index: src/tests/tuple/tupleFunction.c
===================================================================
--- src/tests/tuple/tupleFunction.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tupleFunction.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,98 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleFunction.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue Nov 15 17:27:28 2016
+// Update Count     : 3
+//
+
+struct S {
+	int f1, f2;
+	char f3;
+	double f4;
+} v;
+
+[int] foo( [int, int, double, S] x ) {
+	printf("foo([%d, %d, %lg, {%d, %d, %c, %lg}])\n", x.0, x.1, x.2, x.3.[f1, f2, f3, f4]);
+	int a, b;
+	double c;
+	S d;
+	[a, b, c, d] = x;
+	[int, int, double, S] X = x;
+	printf("a=%d b=%d c=%lg d={%d, %d, %c, %lg}\n", a, b, c, d.[f1, f2, f3, f4]);
+	printf("X=[%d, %d, %lg, {%d, %d, %c, %lg}]\n", X.0, X.1, X.2, X.3.[f1, f2, f3, f4]);
+	return b;
+}
+
+[void] bar( [int, double, int] z ) {
+	printf("bar([%d, %lg, %d])\n", z);
+}
+
+[void] baz( int a, double b, int c ) {
+	printf("baz(%d, %lg, %d)\n", a, b, c);
+}
+
+[void] qux( [int, double] n, int m ) {
+	printf("qux([%d, %lg], %d)\n", n, m);
+}
+
+[int, double x, int] quux() {
+	return [3, 5.254, 4];
+}
+[[[int, double, int], [int, double]]] quuux() {
+	return [1, 2, 3, 4, 5];
+}
+
+int main() {
+	[int, double, int] x = [777, 2.76, 8675];
+	int x1 = 123, x3 = 456;
+	double x2 = 999.123;
+
+	printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
+
+	// call function with tuple parameter using tuple variable arg
+	bar(x);
+
+	// call function with tuple parameter using multiple values
+	bar(x1, x2, x3);
+
+	// call function with multiple parameters using tuple variable arg
+	baz(x);
+
+	// call function with multiple parameters using multiple args
+	baz(x1, x2, x3);
+
+	// call function with multiple parameters, one of which is a tuple using tuple variable arg
+	qux(x);
+
+	// call function with multiple parameters, one of which is a tuple using multiple args
+	qux(x1, x2, x3);
+
+	// call function with multiple return values and assign into a tuple variable
+	x = quux();
+	printf("x=[%d, %lg, %d]\n", x);
+
+	// call function with multiple return values and assign into a tuple expression
+	[x1, x2, x3] = quux();
+	printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3);
+
+	// xxx - tuples of type parameters should come out as generic types?
+	// [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
+	// ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
+	// printf("%d %g %d\n", x1, x2, x3);
+
+	// 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
+	// ([int, double])x;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
+
Index: src/tests/tuple/tupleMember.c
===================================================================
--- src/tests/tuple/tupleMember.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tupleMember.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,61 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleFunction.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue Nov 15 17:27:28 2016
+// Update Count     : 3
+//
+
+void f() {
+	printf("called f!\n");
+}
+
+double g(double x, char y, int z) {
+	return z-y+x;
+}
+
+struct V2	{
+	int f2, f3;
+};
+struct V {
+	int f1;
+	V2 i; // temporary
+	// struct V2 {
+	//   int f2, f3;
+	// } i;
+	double f4;
+} v;
+
+V & h() {
+	static V local = { 111, { 222, 333 }, 444.5 };
+	return local;
+}
+
+int main() {
+	struct X {
+		int a;
+		double b;
+		char c;
+	} x = { 10, 12.5, '\x9' };
+
+	// should only call f once
+	printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
+
+	v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
+
+	printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
+
+	h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
+	printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/tests/tuple/tuplePolymorphism.c
===================================================================
--- src/tests/tuple/tuplePolymorphism.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tuplePolymorphism.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,74 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tuplePolymorphism.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 16 10:38:00 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu May 18 18:05:12 2017
+// Update Count     : 4
+//
+
+// packed is needed so that structs are not passed with the same alignment as function arguments
+__attribute__((packed)) struct A {
+	double x;
+	char y;
+	double z;
+};
+
+__attribute__((packed)) struct B {
+	long long x;
+	char y;
+	long long z;
+};
+
+// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
+[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; }
+forall(otype T, otype U | { T f(T, U, U); })
+void g(T x, U y) { f(x, y, y); }
+
+// add two triples
+forall(otype T | { T ?+?(T, T); })
+[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
+	return [x.0+y.0, x.1+y.1, x.2+y.2];
+}
+
+int main() {
+	int x1 = 123, x3 = 456;
+	double x2 = 999.123;
+
+	int i1 = 111, i3 = 222;
+	double i2 = 333;
+
+	int d1 = 555, d3 = 444;
+	double d2 = 666;
+
+
+	[i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
+	[d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
+	printf("%d %g %d\n", i1, i2, i3);
+	printf("%d %g %d\n", d1, d2, d3);
+
+	[double, double, double] zzz;
+	zzz = [x1, x2, x3];
+	printf("%g %g %g\n", zzz);
+	[x1, x2, x3] = zzz+zzz;
+	printf("%d %g %d\n", x1, x2, x3);
+
+	// ensure non-matching assertions are specialized correctly
+	g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
+}
+
+forall(otype T)
+[T, T] foo([T, T] y) {
+	[T, T] x;
+	return x;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/tests/tuple/tupleVariadic.c
===================================================================
--- src/tests/tuple/tupleVariadic.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tupleVariadic.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,124 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tuplePolymorphism.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Fri Dec 16 10:25:35 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Fri Dec 21 14:42:48 2016
+// Update Count     : 2
+//
+
+void func(void) {
+	printf("called func(void)\n");
+}
+forall(otype T, ttype Params | { void process(T); void func(Params); })
+void func(T arg1, Params p) {
+	process(arg1);
+	func(p);
+}
+void process(int x) {
+	printf("called process(int) %d\n", x);
+}
+void process(double x) {
+	printf("called process(double) %g\n", x);
+}
+
+forall( dtype T, ttype Params | sized(T) | { void ?{}(T &, Params); } )
+T * new(Params p);
+
+struct array {
+	int * data;
+	int size;
+};
+
+// xxx - eventually this will be collapsed...x
+void ?{}(array & a) {
+	a.size = 0;
+	a.data = 0;
+	printf("called ?{} with no a\n");
+}
+
+void ?{}(array & a, int a0) {
+	a.size = 1;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	printf("called ?{} with a: %d\n", a0);
+}
+
+void ?{}(array & a, int a0, int a1) {
+	a.size = 2;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	printf("called ?{} with a: %d %d\n", a0, a1);
+}
+
+void ?{}(array & a, int a0, int a1, int a2) {
+	a.size = 3;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	a.data[2] = a2;
+	printf("called ?{} with a: %d %d %d\n", a0, a1, a2);
+}
+
+// test use of a tuple argument
+[void] ?{}(array & a, [int, int, int, int] args) {
+	int a0, a1, a2, a3;
+	[a0, a1, a2, a3] = args;
+	a.size = 4;
+	a.data = (int *)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	a.data[2] = a2;
+	a.data[3] = a3;
+	printf("called ?{} with a: %d %d %d %d\n", a0, a1, a2, a3);
+}
+
+void print(array * x) {
+	printf("array = { ");
+	for (int i = 0; i < x->size; ++i) {
+		printf("%d, ", x->data[i]);
+	}
+	printf("}\n");
+}
+
+forall(otype T)
+T * copy(T x) {
+	// test calling new inside a polymorphic function
+	return new(x);
+}
+
+int main() {
+	array * x0 = new();
+	print(x0);
+
+	array * x1 = new(999);
+	print(x1);
+
+	array * x2 = new(123, 456);
+	print(x2);
+
+	array * x3 = new(100, 200, 300);
+	print(x3);
+
+	array * x4 = new(10, 2, 3, 4);
+	print(x4);
+
+	int * ptr = copy(111111);
+	printf("copy=%d\n", *ptr);
+
+	printf("calling func\n");
+	func(3, 2.0, 111, 4.145);
+	printf("finished func\n");
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
+
Index: src/tests/tuple/tuples.c
===================================================================
--- src/tests/tuple/tuples.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
+++ src/tests/tuple/tuples.c	(revision 300d75b9c8dd241e0cb0107c7549e5c8400a1024)
@@ -0,0 +1,32 @@
+int a;
+float a;
+int f( int );
+float f( float );
+
+void g() {
+	// selects the same f each time but without a cast would be ambiguous
+	f( (int)a );
+	(int)f( a );
+}
+
+[ int ] p;
+[ int, double ] p;
+[ int, int, int ] p;
+[ int, int, int, int ] p;
+
+[ char ] q;
+[ int, int ] q;
+[ int, int, float ] q;
+[ int, int, int, int ] q;
+
+[ int, int ] r( int, int, int, int );
+
+void s() {
+	r( p, q );
+	r( [ q, p ] );
+	r( r( p, q ), r( q, q ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/tests/tupleAssign.c
===================================================================
--- src/tests/tupleAssign.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,66 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleAssign.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Mar  6 21:23:58 2017
-// Update Count     : 34
-//
-
-#include <fstream>
-
-int main() {
-	{
-		// test multiple assignment and cascading assignment
-		int u = 5, v = 6, x = 10, y = 11;
-		[int, int] z = [100, 200];
-
-		// swap x, y and store the new [x, y] in [u, v] and in z;
-		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
-		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
-		z = [u, v] = [x, y] = [y, x];
-		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
-		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
-
-		// shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
-		[v, z, u] = [z, u, v];
-		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
-		sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
-
-		// multiple assignment with tuple expression on right
-		z = [111, 222];
-		[u, v] = [123, 456];
-		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
-		sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
-	}
-	{
-		// test mass assignment
-		double d = 0.0;
-		int i = 0;
-		char c = '\0';
-		struct X {
-			int z;
-		} x;
-		X ?=?(X & x, double d) {}
-		[int, double, int] t;
-
-		// no conversion from X to integral types, so this serves as a santiy
-		// check that as long as this compiles, ?=?(_, x) is not generated.
-		[t, x, d, i, c, x] = (double)94.12;
-		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
-		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
-		[x, c, i, d, x, t] = (double)-94.12;
-		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
-		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
-	}
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: src/tests/tupleCast.c
===================================================================
--- src/tests/tupleCast.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,30 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleCast.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Mon Dec 12 15:56:07 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Mon Dec 12 15:56:20 2016
-// Update Count     : 2
-//
-
-[char, int, double] f() { printf("ran f\n"); return ['c', 70, 6.28]; }
-
-int main() {
-  [int, char, float] x = [10, 'A', 3.14f];
-  printf("%d %c %g\n", ([int, char, float])x);
-  printf("%d %c\n", ([int, char])x);
-  printf("%d\n", ([int])x);
-  // printf("%d\n", (int)x);
-  printf("%g %g\n", ([double, float])x);
-  printf("%d %c\n", ([int, char])f());
-}
-
-// Local Variables: //
-// tab-width: 2 //
-// End: //
Index: src/tests/tupleFunction.c
===================================================================
--- src/tests/tupleFunction.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,98 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleFunction.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Tue Nov 15 17:27:28 2016
-// Update Count     : 3
-//
-
-struct S {
-	int f1, f2;
-	char f3;
-	double f4;
-} v;
-
-[int] foo( [int, int, double, S] x ) {
-	printf("foo([%d, %d, %lg, {%d, %d, %c, %lg}])\n", x.0, x.1, x.2, x.3.[f1, f2, f3, f4]);
-	int a, b;
-	double c;
-	S d;
-	[a, b, c, d] = x;
-	[int, int, double, S] X = x;
-	printf("a=%d b=%d c=%lg d={%d, %d, %c, %lg}\n", a, b, c, d.[f1, f2, f3, f4]);
-	printf("X=[%d, %d, %lg, {%d, %d, %c, %lg}]\n", X.0, X.1, X.2, X.3.[f1, f2, f3, f4]);
-	return b;
-}
-
-[void] bar( [int, double, int] z ) {
-	printf("bar([%d, %lg, %d])\n", z);
-}
-
-[void] baz( int a, double b, int c ) {
-	printf("baz(%d, %lg, %d)\n", a, b, c);
-}
-
-[void] qux( [int, double] n, int m ) {
-	printf("qux([%d, %lg], %d)\n", n, m);
-}
-
-[int, double x, int] quux() {
-	return [3, 5.254, 4];
-}
-[[[int, double, int], [int, double]]] quuux() {
-	return [1, 2, 3, 4, 5];
-}
-
-int main() {
-	[int, double, int] x = [777, 2.76, 8675];
-	int x1 = 123, x3 = 456;
-	double x2 = 999.123;
-
-	printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
-
-	// call function with tuple parameter using tuple variable arg
-	bar(x);
-
-	// call function with tuple parameter using multiple values
-	bar(x1, x2, x3);
-
-	// call function with multiple parameters using tuple variable arg
-	baz(x);
-
-	// call function with multiple parameters using multiple args
-	baz(x1, x2, x3);
-
-	// call function with multiple parameters, one of which is a tuple using tuple variable arg
-	qux(x);
-
-	// call function with multiple parameters, one of which is a tuple using multiple args
-	qux(x1, x2, x3);
-
-	// call function with multiple return values and assign into a tuple variable
-	x = quux();
-	printf("x=[%d, %lg, %d]\n", x);
-
-	// call function with multiple return values and assign into a tuple expression
-	[x1, x2, x3] = quux();
-	printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3);
-
-	// xxx - tuples of type parameters should come out as generic types?
-	// [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
-	// ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
-	// printf("%d %g %d\n", x1, x2, x3);
-
-	// 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
-	// ([int, double])x;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
-
Index: src/tests/tupleMember.c
===================================================================
--- src/tests/tupleMember.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,61 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleFunction.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Tue Nov 15 17:27:28 2016
-// Update Count     : 3
-//
-
-void f() {
-	printf("called f!\n");
-}
-
-double g(double x, char y, int z) {
-	return z-y+x;
-}
-
-struct V2	{
-	int f2, f3;
-};
-struct V {
-	int f1;
-	V2 i; // temporary
-	// struct V2 {
-	//   int f2, f3;
-	// } i;
-	double f4;
-} v;
-
-V & h() {
-	static V local = { 111, { 222, 333 }, 444.5 };
-	return local;
-}
-
-int main() {
-	struct X {
-		int a;
-		double b;
-		char c;
-	} x = { 10, 12.5, '\x9' };
-
-	// should only call f once
-	printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
-
-	v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
-
-	printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
-
-	h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
-	printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: src/tests/tuplePolymorphism.c
===================================================================
--- src/tests/tuplePolymorphism.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,74 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tuplePolymorphism.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 16 10:38:00 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May 18 18:05:12 2017
-// Update Count     : 4
-//
-
-// packed is needed so that structs are not passed with the same alignment as function arguments
-__attribute__((packed)) struct A {
-	double x;
-	char y;
-	double z;
-};
-
-__attribute__((packed)) struct B {
-	long long x;
-	char y;
-	long long z;
-};
-
-// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
-[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; }
-forall(otype T, otype U | { T f(T, U, U); })
-void g(T x, U y) { f(x, y, y); }
-
-// add two triples
-forall(otype T | { T ?+?(T, T); })
-[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
-	return [x.0+y.0, x.1+y.1, x.2+y.2];
-}
-
-int main() {
-	int x1 = 123, x3 = 456;
-	double x2 = 999.123;
-
-	int i1 = 111, i3 = 222;
-	double i2 = 333;
-
-	int d1 = 555, d3 = 444;
-	double d2 = 666;
-
-
-	[i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
-	[d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
-	printf("%d %g %d\n", i1, i2, i3);
-	printf("%d %g %d\n", d1, d2, d3);
-
-	[double, double, double] zzz;
-	zzz = [x1, x2, x3];
-	printf("%g %g %g\n", zzz);
-	[x1, x2, x3] = zzz+zzz;
-	printf("%d %g %d\n", x1, x2, x3);
-
-	// ensure non-matching assertions are specialized correctly
-	g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
-}
-
-forall(otype T)
-[T, T] foo([T, T] y) {
-	[T, T] x;
-	return x;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: src/tests/tupleVariadic.c
===================================================================
--- src/tests/tupleVariadic.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,124 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tuplePolymorphism.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Fri Dec 16 10:25:35 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Fri Dec 21 14:42:48 2016
-// Update Count     : 2
-//
-
-void func(void) {
-	printf("called func(void)\n");
-}
-forall(otype T, ttype Params | { void process(T); void func(Params); })
-void func(T arg1, Params p) {
-	process(arg1);
-	func(p);
-}
-void process(int x) {
-	printf("called process(int) %d\n", x);
-}
-void process(double x) {
-	printf("called process(double) %g\n", x);
-}
-
-forall( dtype T, ttype Params | sized(T) | { void ?{}(T &, Params); } )
-T * new(Params p);
-
-struct array {
-	int * data;
-	int size;
-};
-
-// xxx - eventually this will be collapsed...x
-void ?{}(array & a) {
-	a.size = 0;
-	a.data = 0;
-	printf("called ?{} with no a\n");
-}
-
-void ?{}(array & a, int a0) {
-	a.size = 1;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	printf("called ?{} with a: %d\n", a0);
-}
-
-void ?{}(array & a, int a0, int a1) {
-	a.size = 2;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	printf("called ?{} with a: %d %d\n", a0, a1);
-}
-
-void ?{}(array & a, int a0, int a1, int a2) {
-	a.size = 3;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	a.data[2] = a2;
-	printf("called ?{} with a: %d %d %d\n", a0, a1, a2);
-}
-
-// test use of a tuple argument
-[void] ?{}(array & a, [int, int, int, int] args) {
-	int a0, a1, a2, a3;
-	[a0, a1, a2, a3] = args;
-	a.size = 4;
-	a.data = (int *)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	a.data[2] = a2;
-	a.data[3] = a3;
-	printf("called ?{} with a: %d %d %d %d\n", a0, a1, a2, a3);
-}
-
-void print(array * x) {
-	printf("array = { ");
-	for (int i = 0; i < x->size; ++i) {
-		printf("%d, ", x->data[i]);
-	}
-	printf("}\n");
-}
-
-forall(otype T)
-T * copy(T x) {
-	// test calling new inside a polymorphic function
-	return new(x);
-}
-
-int main() {
-	array * x0 = new();
-	print(x0);
-
-	array * x1 = new(999);
-	print(x1);
-
-	array * x2 = new(123, 456);
-	print(x2);
-
-	array * x3 = new(100, 200, 300);
-	print(x3);
-
-	array * x4 = new(10, 2, 3, 4);
-	print(x4);
-
-	int * ptr = copy(111111);
-	printf("copy=%d\n", *ptr);
-
-	printf("calling func\n");
-	func(3, 2.0, 111, 4.145);
-	printf("finished func\n");
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
-
Index: src/tests/tuples.c
===================================================================
--- src/tests/tuples.c	(revision 54aba8dc2740ad848ff31060ce9311cb75d5f7b2)
+++ 	(revision )
@@ -1,32 +1,0 @@
-int a;
-float a;
-int f( int );
-float f( float );
-
-void g() {
-	// selects the same f each time but without a cast would be ambiguous
-	f( (int)a );
-	(int)f( a );
-}
-
-[ int ] p;
-[ int, double ] p;
-[ int, int, int ] p;
-[ int, int, int, int ] p;
-
-[ char ] q;
-[ int, int ] q;
-[ int, int, float ] q;
-[ int, int, int, int ] q;
-
-[ int, int ] r( int, int, int, int );
-
-void s() {
-	r( p, q );
-	r( [ q, p ] );
-	r( r( p, q ), r( q, q ) );
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
