Skip to content

Fix missing checks for duplicate literals in variants with payloads. #7441

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 1 commit into from
May 8, 2025

Conversation

cristianoc
Copy link
Collaborator

Fixes #7438

In variant definitions without payloads, an error is reported if two cases have the same literal @as(literal). The check so far was missing for cases with payload, where the literal goes into the tag. However it's perfectly possible to use the same tag in a case without payload, and one with payloads, as the two representations don't overlap.

Fixes #7438

In variant definitions without payloads, an error is reported if two cases have the same literal `@as(literal)`.
The check so far was missing for cases with payload, where the literal goes into the tag.
However it's perfectly possible to use the same tag in a case without payload, and one with payloads, as the two representations don't overlap.
@cristianoc cristianoc force-pushed the multiple_tags_variants branch from 8387450 to c570d40 Compare May 8, 2025 08:52
Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link

pkg-pr-new bot commented May 8, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7441

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7441

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7441

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7441

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7441

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7441

commit: c570d40

@cristianoc cristianoc merged commit a87e656 into master May 8, 2025
21 checks passed
@cristianoc cristianoc deleted the multiple_tags_variants branch May 8, 2025 09:00
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.

variant with @tag, inline record payload, and duplicate custom tag compiles / produces unsafe code
2 participants