some type safety for Fix#57314
Conversation
Disallows any type `Fix{x}` where `!(x isa Int) || (x < 0)`.
Follows up on PR JuliaLang#54653.
The goals are similar as in the closed PR JuliaLang#56518, but less ambitious.
I hope it's not too late in the release cycle to consider this change
as it seems not to be invasive or disruptive.
|
This PR leaves a kind of hole, in that negatives are disallowed by subtyping for the value of the type parameter, but zero is only disallowed by the constructor method. This could hypothetically be patched in a future PR by changing the offset from one-based to zero-based, however that seems like it'd be less worthwhile, so it makes sense to leave it for the future, if this one gets merged. Even with the hole, this change is an improvement IMO, seeing as it makes expressions like |
vtjnash
left a comment
There was a problem hiding this comment.
Adding random type parameters is slightly breaking and inefficient, so this is not going to get merged either unless you can show a compelling use for why this either prevents a soundness issue or enables a new feature
Disallows any type
Fix{x}where!(x isa Int) || (x < 0).Follows up on PR #54653.
The goals are similar as in the closed PR #56518, but less ambitious.
I hope it's not too late in the release cycle to consider this change as it seems not to be invasive or disruptive.