Prefer normal functions if one is defined #829
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So the reason why my custom
store
function wasn't being used is because the generic functionstore{T}(a: T, b: T) -> T
matches all types when the stored value is the same type as the original value, and the wayresolve_function
worked before (because the borrow checker made that the easiest way to implement it), it would first see if any generic function can resolve for the desired function and use that, then if not, it would check if there's a "normal" function that would do. This worked most of the time because there was never a generic function that also matched a "normal" function within the codebase, yet, but if there's ever a match for both generic and normal, the normal function, which had to be handwritten by the developer, should be preferred, so this PR reverses that and then updates the new gpu test back to the desiredstore
syntax (desired because it should also work with=
, but a bit confusing here as written as alet
assignment as well, so I stuck with the method syntax).