Odin
Odin copied to clipboard
assignment of generic procs with ternary operator fails
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.
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..
Still a problem in dev-2022-12:1d6f7680.
Please reopen.
The fn_ = fn statement produces an error for me starting with commit https://github.com/odin-lang/Odin/commit/0a0db23b1751c0b7021cc1b3af3329b5d93cf9da
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?