Skip to content

cgen: prefer exact alias tags in sumtype match#27719

Open
medvednikov wants to merge 1 commit into
masterfrom
fix-27718-sumtype-alias-match
Open

cgen: prefer exact alias tags in sumtype match#27719
medvednikov wants to merge 1 commit into
masterfrom
fix-27718-sumtype-alias-match

Conversation

@medvednikov

Copy link
Copy Markdown
Member

Fixes #27718

This makes sumtype match branch dispatch prefer the exact runtime tag when the branch type is itself a declared variant. Alias-compatible tag matching is still used as a fallback for aliases that are not explicit variants of the matched sum type.

Tests:

  • ./vnew vlib/v/tests/aliases/alias_is_match_runtime_tag_test.v
  • ./vnew -e <issue 27718 reproduction>
  • ./vnew -silent vlib/v/compiler_errors_test.v
  • ./vnew -silent vlib/v/gen/c/coutput_test.v
  • ./vnew -silent test vlib/v/

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.

smart cast regression: bad matching on a sum type when a type refers to another

1 participant