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(stackable-versioned): Emit type parameter defaults #991

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[versioned(version(name = "v1alpha1"), version(name = "v1"))]
// ---
pub struct Foo<T = String>
where
T: Default,
{
bar: T,
baz: u8,
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ pub(crate) struct Enum {
impl Enum {
/// Generates code for the enum definition.
pub(crate) fn generate_definition(&self, version: &VersionDefinition) -> TokenStream {
let (_, type_generics, where_clause) = self.generics.split_for_impl();
let where_clause = self.generics.where_clause.as_ref();
let type_generics = &self.generics;

let original_attributes = &self.common.original_attributes;
let ident = &self.common.idents.original;
let version_docs = &version.docs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ pub(crate) struct Struct {
impl Struct {
/// Generates code for the struct definition.
pub(crate) fn generate_definition(&self, version: &VersionDefinition) -> TokenStream {
let (_, type_generics, where_clause) = self.generics.split_for_impl();
let where_clause = self.generics.where_clause.as_ref();
let type_generics = &self.generics;

let original_attributes = &self.common.original_attributes;
let ident = &self.common.idents.original;
let version_docs = &version.docs;
Expand Down
6 changes: 6 additions & 0 deletions crates/stackable-versioned/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Fixed

- Correctly emit generic type parameter defaults in enum/struct definition blocks ([#991]).

[#991]: https://github.com/stackabletech/operator-rs/pull/991

## [0.7.0] - 2025-03-17

### Changed
Expand Down