Skip to content
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

Prefer normal functions if one is defined #829

Merged
merged 4 commits into from
Aug 5, 2024
Merged

Conversation

dfellis
Copy link
Member

@dfellis dfellis commented Aug 5, 2024

So the reason why my custom store function wasn't being used is because the generic function store{T}(a: T, b: T) -> T matches all types when the stored value is the same type as the original value, and the way resolve_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 desired store syntax (desired because it should also work with =, but a bit confusing here as written as a let assignment as well, so I stuck with the method syntax).

@dfellis dfellis self-assigned this Aug 5, 2024
src/program/scope.rs Fixed Show fixed Hide fixed
src/program/scope.rs Fixed Show fixed Hide fixed
@dfellis dfellis merged commit 8f54d0d into main Aug 5, 2024
11 checks passed
@dfellis dfellis deleted the prefer-normal-functions branch August 5, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant