-
Notifications
You must be signed in to change notification settings - Fork 186
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
TypeConformance with generics does not work #4749
Comments
It seems like that this still does not work. The compiler does not crash anymore but the compilation errors out with the following message.
I used |
Did you add a ITypeConformance to your CompositeComponentType that represents your program. If not, this is an expected behavior. |
Hi, I'm a collaborator of the author, the following code describes how we add the type conformance to the program:
Basically we get the type reflections of the base type and implementing type by name. Then we create the ITypeConformance using the type reflections, which is then later added to a vector with IComponentType values for program composition, like so:
The diagnosticBlob checks and SLANG_FAILED checks all seem to not detect any issue, and the values of the TypeReflections and ITypeConformance also seem to be valid in the debugger. I can also confirm that the ITypeConformance t_c is indeed in the _programComponents vector. |
One thing I want to make sure is that there aren't mixed uses of modules and |
I will need to understand more on what is the difference between your use case, and the test case here: tests/language-feature/interfaces/generic-interface-conformance.slang |
Strange, the exact example you linked above also does not work. Without the generic it does though. When I set the generic TypeConformance I do it with We call |
this line In the test file does the exactly that, so I am not sure why it works in the test but not in your application. Would it be possible for you to share a standalone cpp program that reproduces this? |
You can find it in here using some small abstractions for slang: Note: Only tried to compile it on windows |
I'm able to reproduce this.. looks like a bug with witness table specialization being skipped because the inst has no uses until later in the generics lowering process. This didn't happen with the test case because the I think it should be a quick fix. Will open a PR asap. |
So when having an interface which is templated, it is possible now to correctly set the type conformance with strings of the interface and implementation struct + the implementing generic type "TestInterface<float>" "TestInterfaceImpl<float>". Sadly this still results in an
error 50100: No type conformances are found for interface 'TestInterface'. Code generation for current target requires at least one implementation type present in the linkage.
error
Shortened code:
The text was updated successfully, but these errors were encountered: