Simple grouping with untyped properties or open types #2034
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.
In the simple grouping algorithm, the last sub-bullet point of the projection function says:
and the recursively called function$s_G$ assumes that its first argument is a structured instance. But if $q$ is an untyped property or a property of an open type, $u[q]$ can also be primitive1, and then the first bullet point does not make sense:
I suggest to rephrase the last sub-bullet point so that the recursive call is omitted in such cases. This is the least invasive change and its leads to$q$ being omitted from the projection.
1 Of course$u[q]$ can also be primitive if $q$ declares a primitive type, but the problem occurs only if $p'$ is a prefix of a path in $G$ , which means for a grouping criterion of the form $q/r$ or $s/q/r$ . And if $q$ declares a primitive type, $q/r$ does not make sense at all.