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 checker incorrectly allows passing of non-pointer values to pointers #758

Open
yorickpeterse opened this issue Sep 5, 2024 · 0 comments
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler

Comments

@yorickpeterse
Copy link
Collaborator

Please describe the bug

When passing non-pointer values, such as a Foo or ref Foo, the type checker allows such values to be passed when a Pointer[T] is expected:

class Thing {}

fn example[T](value: Pointer[T]) -> Pointer[T] {
  value
}

class async Main {
  fn async main {
    example(Thing())
  }
}

This should produce a compile-time error, but it doesn't.

We should disallow passing anything to a Pointer unless the value itself is already a pointer.

Operating system

Fedora

Inko version

main

@yorickpeterse yorickpeterse added accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler
Projects
None yet
Development

No branches or pull requests

1 participant