Improved and bugfixed template infrance to be able to infrence based on function types too

This commit is contained in:
Nathan Braswell
2015-05-25 12:11:45 -04:00
parent 7448a88f66
commit 90c66f3037
2 changed files with 21 additions and 0 deletions

View File

@@ -1,5 +1,22 @@
import io:*
fun funcID<T>(genFun: fun():T):T {
return genFun()
}
fun retInt():int {
return 9
}
fun doThePrint<T>(func: fun(T):void):void {
func(10)
}
fun printInt(it:int):void {
println(it)
}
fun ptrFn<T>(ptr: T*):void {
println(*ptr)
}
@@ -7,6 +24,8 @@ fun ptrFn<T>(ptr: T*):void {
fun main():int {
var a = 8
ptrFn(&a)
println(funcID(retInt))
doThePrint(printInt)
return 0
}