inko
inko copied to clipboard
Type inference fails to infer pointer types in certain cases
Please describe the bug
When running the following code, the return value of allocate
is inferred as move T
instead of Pointer[T]
, which should then be inferred as Pointer[Int]
:
fn extern malloc(size: UInt64) -> Pointer[UInt8]
fn allocate[T](size: Int) -> Pointer[T] {
malloc(size as UInt64) as Pointer[T]
}
class async Main {
fn async main {
let x: Pointer[Int] = allocate(42)
}
}
Operating system
Fedora
Inko version
main