Skip to content

assignment of generic procs with ternary operator fails #1239

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

Open
awwdev opened this issue Oct 23, 2021 · 3 comments
Open

assignment of generic procs with ternary operator fails #1239

awwdev opened this issue Oct 23, 2021 · 3 comments
Labels

Comments

@awwdev
Copy link
Member

awwdev commented Oct 23, 2021

Odin dev-2021-10:eebf49ba

fn_ : proc(_: int) //proc pointer
fn :: proc(_: $T ) {}

fn_ = fn //works
if true do fn_ = fn else do fn_ = fn //works

fn_ = true ? fn : fn //doesn't work

Cannot assign value 'true ? fn : fn' of type 'proc($T)' to 'proc(int)' in assignment

This is possibly a bug / oversight.
The generic proc fn can be specialised, anytime, to (proc :: (_: int)) and thus matches the signature of the function pointer fn_ no matter the syntactic sugar you use.

@github-actions
Copy link

Hello!

I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan on resolving the issue.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..

@github-actions github-actions bot added stale and removed stale labels Jul 24, 2022
@github-actions github-actions bot added the stale label Nov 22, 2022
@awwdev
Copy link
Member Author

awwdev commented Dec 25, 2022

Still a problem in dev-2022-12:1d6f7680.
Please reopen.

@gingerBill gingerBill reopened this Jan 1, 2023
@github-actions github-actions bot removed the stale label Jan 2, 2023
@github-actions github-actions bot added the stale label May 3, 2023
@rick-masters
Copy link
Contributor

The fn_ = fn statement produces an error for me starting with commit 0a0db23

main.odin(7:16) Cannot determine polymorphic type from parameter: 'invalid type' to '$T'
main.odin(9:11) Cannot assign value 'fn' of type 'proc($T)' to 'proc(int)' in assignment

Seems like it is now working as it should?

@github-actions github-actions bot removed the stale label Mar 27, 2024
@github-actions github-actions bot added the stale label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants