diff --git a/src/ASTTransformation.cpp b/src/ASTTransformation.cpp index 1eb2781..1b10cbf 100644 --- a/src/ASTTransformation.cpp +++ b/src/ASTTransformation.cpp @@ -1013,12 +1013,14 @@ NodeTree* ASTTransformation::templateClassLookup(NodeTree* sco void ASTTransformation::unifyType(NodeTree *syntaxType, Type type, std::map* templateTypeMap) { // Ok, 3 options for syntaxType here. // 1) This a basic type. (int, or object, etc) - // then check to see if it's the same as our type + // THIS ONE will fall through and get put in the map, but it + // doesn't matter b/c it'll get filterd out in unifyTemplateFunction // 2) This is a template type type (i.e. T) // match! set up templateTypeMap[T] -> type // 3) This some sort of instantiated template // a) instantiated with some other type (i.e. vector) - // this will be a bit of a pain + // THIS ONE will fall through and get put in the map, but it + // doesn't matter b/c it'll get filterd out in unifyTemplateFunction // b) instantiated with a template type type (i.e. vector) // this will be a bit of a pain too diff --git a/tests/test_templateFuncInfr.expected_results b/tests/test_templateFuncInfr.expected_results index c1f3abd..ae1b4c8 100644 --- a/tests/test_templateFuncInfr.expected_results +++ b/tests/test_templateFuncInfr.expected_results @@ -1,2 +1,5 @@ 11 12 +9 +13.880000 +test string diff --git a/tests/test_templateFuncInfr.krak b/tests/test_templateFuncInfr.krak index 138eab1..fcd56cf 100644 --- a/tests/test_templateFuncInfr.krak +++ b/tests/test_templateFuncInfr.krak @@ -2,8 +2,18 @@ import io:* import mem:* import vector:* +typedef pair { + var first: T + var second: U +} + fun id(in: T): T { return in; } fun idVec(in: vector): T { return in.get(0); } +fun pairFun(in: pair, another:double): T { + println(in.second) + println(another) + return in.first; +} fun main():int { var fromTemplateFun = id(11) @@ -11,6 +21,10 @@ fun main():int { aVec.addEnd(12) println(fromTemplateFun) println(idVec(aVec)) - //println(idVec(aVec)) + var testPair: pair + testPair.first = "test string" + testPair.second = 9 + var someFloat = 13.88 + println(pairFun(testPair, someFloat)) return 0 }