Skip to content

fix(stackable-versioned): Emit correct match arms for version enum #1065

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 6 commits into from
Jun 26, 2025

Conversation

Techassi
Copy link
Member

This is rather curious because the previous generated code should result in compiler errors. The expanded code does not error, but manually copy+pasting the generated code reveals the compiler error as expected:

error[E0170]: pattern binding `V1Alpha1` is named the same as one of the variants of the type `FooVersion`
   --> crates/stackable-versioned-macros/tests/test.rs:324:13
    |
324 |             V1Alpha1 => "v1alpha1",
    |             ^^^^^^^^ help: to match on the variant, qualify the path: `FooVersion::V1Alpha1`
    |
    = note: `#[deny(bindings_with_variant_name)]` on by default

The incorrect match resulted in as_str to always return the earliest version (usually v1alpha1). This resulted in the wrong version to be marked as stored when calling Foo::merged_crd.

@Techassi Techassi self-assigned this Jun 26, 2025
@Techassi Techassi moved this to Development: In Progress in Stackable Engineering Jun 26, 2025
@Techassi Techassi changed the title fix(stackable-versioned): Emit correct match arms for as_str funtion fix(stackable-versioned): Emit correct match arms for version enum Jun 26, 2025
@Techassi Techassi marked this pull request as ready for review June 26, 2025 09:49
@Techassi Techassi moved this from Development: In Progress to Development: Track in Stackable Engineering Jun 26, 2025
@Techassi Techassi moved this from Development: Track to Development: Waiting for Review in Stackable Engineering Jun 26, 2025
@Techassi Techassi moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Jun 26, 2025
@Techassi Techassi added this pull request to the merge queue Jun 26, 2025
@Techassi Techassi moved this from Development: In Review to Development: Done in Stackable Engineering Jun 26, 2025
Merged via the queue into main with commit 7b39422 Jun 26, 2025
8 checks passed
@Techassi Techassi deleted the fix/stackable-versioned-version-enum-as-str branch June 26, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Development: Done
Development

Successfully merging this pull request may close these issues.

3 participants