inko icon indicating copy to clipboard operation
inko copied to clipboard

Type inference fails to infer pointer types in certain cases

Open yorickpeterse opened this issue 5 months ago • 0 comments

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

yorickpeterse avatar Sep 04 '24 12:09 yorickpeterse