-
Notifications
You must be signed in to change notification settings - Fork 350
Support expand
on concrete tuple values.
#8106
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
Conversation
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.
I had also started on this yesterday (minus the overload part), but got preoccupied with something else and luckily didn't get too far yet. I had stopped when I realized I'd need a function like the maybeExpandArgList
you implemented 😄
It's good that we can remove isInVariadicGenerics
. isKeywordAvailable
is in general a really nice solution IMO, since now we can add new keywords without breaking changes.
One more thing I'd like to see tested, is this case:
Tuple<int, float> x = (2, 3.0f);
float arr[2];
int i = 0;
expand arr[i++] = float(each x);
or in general, expanding concrete tuples outside of function call parameters. I encountered a type-related error with that code even after allowing expand-each outside of variadic generics. I'm not on a PC with slangc currently, so can't check what it was or if this PR has already fixed it. Either way, I'd feel more comfortable with something like that being in the tests.
@juliusikkala I don't think your code is valid though, because there is no overload of float.init that will take a generic type like each T without any constraints. |
Again, even with concrete types, the expression inside expand is checked before expansion, similar to other generic cases. |
Ah ok, that's a bit unfortunate :( but if that's the desired behaviour, then LGTM |
Closes shader-slang#8061. Along with the fix, also enhanced coercion/overload resolution to filter candidates based on the target type, allowing `tests\language-feature\higher-order-functions\overloaded.slang` to pass.
Closes #8061.
Along with the fix, also enhanced coercion/overload resolution to filter candidates based on the target type, allowing
tests\language-feature\higher-order-functions\overloaded.slang
to pass.