Skip to content
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

Relax rules related to product types #98

Closed
dlurton opened this issue Oct 1, 2021 · 0 comments · Fixed by #107
Closed

Relax rules related to product types #98

dlurton opened this issue Oct 1, 2021 · 0 comments · Fixed by #107
Assignees

Comments

@dlurton
Copy link
Member

dlurton commented Oct 1, 2021

Currently, PIG will issue an error and fail the build if any product types are present that:

  • have both optional and variadic elements.
  • have any optional elements are not grouped together at the end of the production definition.

These are actually relics left over from a time when we non-present optional values were simply omitted from s-expression representation. The rules were necessary to avoid ambiguity when converting from the s-expression representation to the Kotlin classes. However, since this validation logic was added we modified it so that we now represent non-present optional values with Ion nulls, and therefore this static check shouldn't be needed anymore.

Thus, the following product definitions which are not valid today, should actually be valid:

(product foo bar::(? int) bat::int)
(product foo bar:: int bat::(? int) baz::(* int 0))

Note that, product types still can only support a single variadic element and that it must be at the end and this cannot change unless we also change how we represent variadic elements and that is beyond the scope of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants