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

fix: nested ternary in calculated element #981

Merged
merged 3 commits into from
Jan 17, 2025
Merged

fix: nested ternary in calculated element #981

merged 3 commits into from
Jan 17, 2025

Conversation

patricebender
Copy link
Member

calculated elements may reference other calcuated elements and so forth.. that is why we have logic in place which constructs subpaths for such scenarios which enables us to calculate joins deeply built into a given calculated element hierarchy. However, the logic had a flaw for e.g. nested ternary expressions.

For (1 > 0 ? 1 : (book.stock > 10 ? value : 3));

we accidentally constructed subpaths like book.stock.value which led to an error because we tried to create a join for value, where no association prefix is present.

fix cap/issue#17660

calculated elements may reference other calcuated elements
and so forth.. that is why we have logic in place which
constructs subpaths for such scenarios which enables us
to calculate joins deeply built into a given calculated element
hierarchy. However, the logic had a flaw for e.g. nested ternary
expressions.

For `(1 > 0 ? 1 : (book.stock > 10 ? value : 3));`

we accidentally constructed subpaths like `book.stock.value` which
led to an error because we tried to create a join for `value`, where
no association prefix is present.

fix cap/issue#17660
@patricebender patricebender marked this pull request as ready for review January 17, 2025 09:39
@patricebender patricebender enabled auto-merge (squash) January 17, 2025 10:56
@patricebender patricebender merged commit 5f4a1fe into main Jan 17, 2025
4 checks passed
@patricebender patricebender deleted the patrice/calc branch January 17, 2025 12:59
@stewsk
Copy link
Contributor

stewsk commented Jan 17, 2025

@patricebender can you please checks whether this works in the compiler?

@cap-bots cap-bots mentioned this pull request Jan 16, 2025
@patricebender
Copy link
Member Author

@patricebender can you please checks whether this works in the compiler?

I did and it doesn't work. Gute Nase! Opened an internal 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 this pull request may close these issues.

2 participants