Skip to content

Do not translate Sorbet assertions in ternary expressions #756

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

Merged
merged 2 commits into from
Jun 9, 2025

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Jun 9, 2025

We do not translate assertions in ternary expressions to avoid altering the semantic of the code.

For example:

a = T.must(b) ? T.must(c) : T.must(d)

would become

a = T.must(b) ? T.must(c) : d #: !nil

which does not match the original intent as it would be type checked as this:

a = T.must(T.must(b) ? T.must(c) : d)

Morriar added 2 commits June 9, 2025 15:49
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar self-assigned this Jun 9, 2025
@Morriar Morriar requested a review from a team as a code owner June 9, 2025 19:52
@Morriar Morriar added the bugfix Fix a bug label Jun 9, 2025
@Morriar Morriar merged commit 234a4b0 into main Jun 9, 2025
8 checks passed
@Morriar Morriar deleted the at-fix-ternary branch June 9, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants