-
Notifications
You must be signed in to change notification settings - Fork 220
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
Recursive shape definitions restriction not restrictive enough part 2 #1247
Comments
Ah good point. The first example is weird, but seems fine to me. The type would end up in PLs like The second example is something we shouldn't allow because it's impossible to provide a value for it. Because unions can have many members that refer to themselves, we would want at least one member of the union to not refer directly to itself in order to allow recursive unions. |
I looked at the PR. I think it only addresses direct recursion. This should also be deemed invalid right? union RecursiveUnion {
a: RecursiveUnion2,
}
union RecursiveUnion2 {
b: RecursiveUnion,
} |
Oh yeah, you’re right. We can follow up here to do a similar path traversal we do with structures. |
This is a follow-up on #1183.
I guess the phrase "unless one or more members in the path from the container back to itself targets a structure or union shape" needs to be tweaked to mention that the union shape must have more than one member (?).
You can otherwise have recursive unions:
But even if you tweaked that sentence, you could still have, more simply:
So I guess a better way to disallow these is to add another bullet point mentioning that union shapes that refer back to themselves must have more than one member?
The text was updated successfully, but these errors were encountered: