reverted some changes that break tests. unfortunately I have no idea why and suspect bugs may be hidden
1 files changed, 11 insertions(+), 28 deletions(-)

M src/backends/SideEffectCompiler.cpp
M src/backends/SideEffectCompiler.cpp +11 -28
@@ 649,11 649,7 @@ namespace K3
 			if (graph->Cast(ds)) return ds->GetDataLayout();
 			else {
 				ResultTypeWithNoArgument rt(graph);
-				auto resTy = graph->Result(rt);
-				if (resTy.IsNativeType() == false) {
-					std::clog << *graph << " -> " << resTy << "\n";
-				}
-				return Native::Constant::New(resTy, 0);
+				return Native::Constant::New(graph->Result(rt), 0);
 			}
 		}
 

          
@@ 813,7 809,7 @@ namespace K3
 					}
 				}
 
-				if (opDrivers.empty() || opDrivers.find(Type(&Reactive::InitializationDriver)) != opDrivers.end()) {
+				if (opDrivers.empty()) {
 					if (!dataDrivers.empty()) {
 						std::cerr << "! Storing undefined value ! <partial -> static>\n" << *finalSrc << " -> " << *finalDst << "\n";
 						for (auto& d : dataDrivers) {

          
@@ 897,7 893,7 @@ namespace K3
 
 			//std::clog << "[src  ] : " << *pureBody << std::endl;
 			//std::clog << "[w/arg] : " << *body << std::endl;
-			//std::clog << "[out  ]: " << *results << std::endl;
+			//std::cout << "[out  ]: " << *results << std::endl;
 
 			elision(body);
 

          
@@ 1007,12 1003,6 @@ namespace K3
 			if (node->Cast(ofs)) return NeverHasData(m->GetUp(0));
 			const DataSource* ds;
 			if (node->Cast(ds)) return NeverHasData(ds->GetDataLayout( ));
-			const VariantTuple* vt;
-			if (node->Cast(vt)) {
-				return
-					NeverHasData(vt->GetUp(0)) &&
-					NeverHasData(vt->GetUp(1));
-			}
 			if (IsPair(node)) {
 				return NeverHasData(First::New(node)) && NeverHasData(Rest::New(node));
 			} else return false;

          
@@ 1723,8 1713,7 @@ namespace K3
 							umul % dmul != 0 ||
 							ddiv % udiv != 0) {
 							// cache is needed as downstream driver is not an exact fraction of the upstream
-							auto boundaries = FactorBoundaries(sfx, upd, upstreamReactivity, GetReactivity());
-							return boundaries;
+							return FactorBoundaries(sfx, upd, upstreamReactivity, GetReactivity());
 						}
 					}
 				}

          
@@ 2103,8 2092,7 @@ namespace K3
 					GetDereferencedParams(sfx, t.Rest(), datum->GraphRest(), rx?rx->Rest():nullptr, CallerParams, ParamID));
 			} else {
 				datum = DereferenceAll(datum, rx);
-				auto layout = sfx.GetDataLayout(datum);
-				auto paramData(DataSource::New(SubroutineArgument::In(ParamID++, rx, datum), layout));
+				auto paramData(DataSource::New(SubroutineArgument::In(ParamID++, rx, datum), sfx.GetDataLayout(datum)));
 				CallerParams.push_back(sfx.GetDataAccessor(datum));
 				return paramData;
 			}

          
@@ 2124,9 2112,8 @@ namespace K3
 						return GetDereferencedParams(sfx, layout->FixedResult(), datum, rx, callerParams, ParamID);
 				} else {
 					callerParams.push_back(sfx.GetDataAccessor(datum));
-					auto layout = sfx.GetDataLayout(datum);
 					auto arg = SubroutineArgument::New(input, ParamID++, datum, rx);
-					return DataSource::New(arg, layout);
+					return DataSource::New(arg, sfx.GetDataLayout(datum));
 				}
 			} else {
 				return Typed::Nil();

          
@@ 2222,22 2209,17 @@ namespace K3
 			}
 
 
-			if (Native::Constant* c = Argument->Cast<Native::Constant>()) {
+			if (Argument->Cast<Native::Constant>() || Argument->Cast<VariantTuple>()) {
+				Native::Constant *c;
 				if (Argument->Cast(c)) {
 					if (c->FixedResult().IsPair() == false) return c;
-				} else {
-					return Type;
 				}
+				return Type;
 			}
 
 			const Reference* ref;
 			if (Argument->Cast(ref)) {
-				return Reference::New(_SubstituteTypeToArgumentGraph(ref->GetUp(0), Type, false));
-			}
-
-			if (Type->Cast<VariantTuple>()) {
-				assert(!splitPairs);
-				return Type;
+				return Reference::New(_SubstituteTypeToArgumentGraph(ref->GetUp(0), Type, splitPairs));
 			}
 
 			return Argument;

          
@@ 2418,6 2400,7 @@ namespace K3
 			//std::cout << "RecursionBranch Argument: " << *ArgumentGraph << std::endl;
 			//std::cout << "Sequence        Result  : " << *SequenceResult << std::endl;
 			//std::cout << "RecursionBranch Result  : " << *ResultGraph << std::endl;
+			//std::cout << "arg " << *argumentReactivity << "\n" << *GetReactivity() << "\n";
 
 			/* add counter argument */
             SubroutineArgument::In(ParamID++, nullptr, Type::Int32, "count");