fused types: specialize each base type only once, also for compound type args #284
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.
This PR removes the cross-product expansion of memoryview fused type args,
and expands permutations only over non-compound fused types. (And also fixes a signature resolution bug, triggered by the second test case added.)
I also make the corresponding change in cpdef signature resolution. The signatures now contain only the base fused types. The signature lookup determines the signature based on the leftmost types.
The case where more than one fused type is contained in a compound type is not handled
in the signature resolution, raises a compiler error. I don't think that this case can currently
happen, however, as it doesn't seem currently possible to typedef structs containing fused
types.
This is a behavior change, as cross-product specializations are no longer generated for
memoryview arguments. However, as discussed on the list, I believe the cross-product expansion is not the correct thing to do, as it creates ambiguities on the meaning of the expanded fused types in the function body.