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

Allow lookups of overloaded methods. #5110

Merged
merged 6 commits into from
Sep 19, 2024

Conversation

saipraveenb25
Copy link
Collaborator

@saipraveenb25 saipraveenb25 commented Sep 18, 2024

  • Allows FunctionReflection* to be either a DeclRefBase* (unique function) or an OverloadedExpr* (multiple candidates)
  • Existing methods of FunctionReflection* except for specializeWithArgTypes will fail & return nullptr if it is overloaded
  • New member methods isOverloaded() -> bool, getOverloadCount() -> unsigned int and getOverload(unsigned int) -> FunctionReflection* can be used to cycle through candidates
  • Alternatively, FunctionReflection::specializeWithArgTypes can be used to resolve to a single function, based on argument types by using invoke resolution, This will also perform generic argument inference where necessary.

Breaking Change Notes:

Previously, the result of findFunctionByName and findFunctionByNameInType return nullptr if the function is overloaded. They will now return a non-null pointer, but they cannot be used with most function-reflection methods without resolving to a unique function. Users should call FunctionReflection::isOverloaded() to decide if the returned function reflection is useful.

Fixes #5090

@saipraveenb25 saipraveenb25 added the pr: breaking change PRs with breaking changes label Sep 18, 2024
@csyonghe csyonghe merged commit dd3d80e into shader-slang:master Sep 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: breaking change PRs with breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reflection API: Allow lookups on overloaded functions
2 participants