-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
allow casting optional
type to numba concrete types
#9161
Conversation
I think this's a simple patch, tests are all passed. But how to fix the towncrier? @esc |
Hi, @sklam . Perhaps this PR can go into 0.58.0rc2 or 0.58.0? I think you can give this a quick review, only change one line source code and add a test for it. |
elif isinstance(val, (types.Number, | ||
types.Boolean, | ||
types.IntEnumMember, | ||
types.Optional)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this permit something that is optional but not like a number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current mainline, we have this, so I think we allow casting optional to any type in the lowering level?
Line 112 in d70830f
@lower_cast(types.Optional, types.Any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR will let typeinfer also allow casting optional to any type (?) in the typing level, I think..
RC2 will be limited to regressions or critical security bugs. This patch will go towards 0.59. |
Added to the milestone for 0.59 |
optional
type to types.int64
optional
type to numba concrete types
I made an alternative PR for this at #9248 |
You can see the added test case.
Without this patch, the test will fail. With this patch, we allow this kind of casting from optional to concrete_type, e.g.,
types.int64(optional_instance)
.