Template function instantiation type inference work - super simple inference works (i.e. id<T>(i:T) { return i; }), and the framework is good, just have to flesh out unifyType to handle more than the trivial case

This commit is contained in:
Nathan Braswell
2015-05-14 00:25:18 -04:00
parent d70fa4ebbb
commit f5e74ca7ce
5 changed files with 125 additions and 48 deletions

View File

@@ -0,0 +1,17 @@
import io:*
import mem:*
import vector:*
fun id<T>(in: T): T { return in; }
fun idVec<T>(in: vector<T>): T { return in.get(0); }
fun main():int {
var fromTemplateFun = id(11)
var aVec.construct(): vector<int>
aVec.addEnd(12)
//var fromTemplateFun = id<int>(11);
println(fromTemplateFun)
println(idVec(aVec))
//println(idVec<int>(aVec))
return 0
}