consider generic param type as typedesc in tuple type expressions #25316
+43
−2
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.
fixes #25312
Tuple expressions
(a, b, c)can be either types or values depending on if their elements are typedescs or values, this is checked by checking if the type of the element istyTypeDesc. However when anskGenericParamsymbol is semchecked bysemSymit is given its owntyGenericParamtype rather than atyTypeDesctype, this seems to be necessary for signatures to allow wildcard generic params passed to static constrained generic params (tested in #25315). The reasonsemSymis called is thatsemGenericfor generic invocations callsmatcheswhich sems its arguments like normal expressions.To deal with this, an expression of type
tyGenericParamand with askGenericParamsym is allowed as a type in the tuple expression. A problem is that this might consider a value with a wildcard generic param type as a type. But this is a very niche problem, and I'm not sure how to check for this.skGenericParamsymbols stay as idents when semchecked so it can't be checked that the node is anskGenericParamsymbol. It could be checked that it's an ident but I don't know how robust this is. And maybe there is another way to refer to a wildcard generic param type instead of just its symbol, i.e. another kind of node.This also makes #5647 finally work but a test case for that can be added after.