Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type inference fails to infer pointer types in certain cases #754

Open
yorickpeterse opened this issue Sep 4, 2024 · 0 comments
Open

Type inference fails to infer pointer types in certain cases #754

yorickpeterse opened this issue Sep 4, 2024 · 0 comments
Labels
bug Defects, unintended behaviour, etc compiler Changes related to the compiler

Comments

@yorickpeterse
Copy link
Collaborator

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 yorickpeterse added bug Defects, unintended behaviour, etc compiler Changes related to the compiler labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defects, unintended behaviour, etc compiler Changes related to the compiler
Projects
None yet
Development

No branches or pull requests

1 participant