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 format of generic argument #995

Merged
merged 1 commit into from
Oct 7, 2024
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
13 changes: 13 additions & 0 deletions crates/formatter/src/aligner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,19 @@ impl VerylWalker for Aligner {
}
}

/// Semantic action for non-terminal 'WithGenericArgumentList'
fn with_generic_argument_list(&mut self, arg: &WithGenericArgumentList) {
self.with_generic_argument_item(&arg.with_generic_argument_item);
for x in &arg.with_generic_argument_list_list {
self.comma(&x.comma);
self.space(1);
self.with_generic_argument_item(&x.with_generic_argument_item);
}
if let Some(ref x) = arg.with_generic_argument_list_opt {
self.comma(&x.comma);
}
}

/// Semantic action for non-terminal 'PortDeclarationItem'
fn port_declaration_item(&mut self, arg: &PortDeclarationItem) {
self.aligns[align_kind::IDENTIFIER].start_item();
Expand Down
2 changes: 1 addition & 1 deletion testcases/map/testcases/sv/58_generic_struct.sv.map

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

6 changes: 6 additions & 0 deletions testcases/sv/58_generic_struct.sv
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ module veryl_testcase_Module58;
C B;
} __StructB__C;

typedef struct packed {
C B;
C C;
} __StructC__C__C;

__StructA__Package58_B _a;
__StructA__Package58_C _b;
__StructA__C _c;
__StructB__Package58_C _d;
__StructB__Package58_C _f;
__StructB__C _e;
__StructC__C__C _g;
endmodule

package veryl_testcase_Package58;
Expand Down
6 changes: 6 additions & 0 deletions testcases/veryl/58_generic_struct.veryl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ module Module58 {
B: T,
}

struct StructC::<T: type, U: type> {
B: T,
C: U,
}

var _a: StructA::<Package58::B>;
var _b: StructA::<Package58::C>;
var _c: StructA::<C> ;
var _d: StructB::<Package58::C>;
var _f: StructB::<Package58::C>;
var _e: StructB::<> ;
var _g: StructC::<C, C> ;
}

package Package58 {
Expand Down