Commit b7ace68 1 parent b2b632b commit b7ace68 Copy full SHA for b7ace68
File tree 5 files changed +19
-4
lines changed
non_entry_point_method/src
tooling/nargo_fmt/src/formatter
5 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ contract Foo {
4
4
5
5
#[abi(bar)]
6
6
pub struct Bar {
7
- inner : Field
7
+ inner : Field ,
8
8
}
9
9
}
Original file line number Diff line number Diff line change 1
1
contract Foo {
2
- pub struct T { x : [Field ] }
2
+ pub struct T {
3
+ x : [Field ],
4
+ }
3
5
4
6
impl T {
5
7
fn t (self ) {
Original file line number Diff line number Diff line change 1
1
contract Foo {
2
- pub struct PlaceholderStruct {x : u32 }
2
+ pub struct PlaceholderStruct {
3
+ x : u32 ,
4
+ }
3
5
4
6
#[contract_library_method]
5
7
pub fn has_mut (_context : &mut PlaceholderStruct ) {}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ echo "[workspace]" > Nargo.toml
33
33
echo " members = [" >> Nargo.toml
34
34
35
35
collect_dirs compile_success_empty
36
- # collect_dirs compile_success_contract
36
+ collect_dirs compile_success_contract
37
37
collect_dirs compile_success_no_bug
38
38
collect_dirs compile_success_with_bug
39
39
collect_dirs execution_success
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ impl<'a> Formatter<'a> {
12
12
let_statement : LetStatement ,
13
13
visibility : ItemVisibility ,
14
14
) {
15
+ self . format_secondary_attributes ( let_statement. attributes . clone ( ) ) ;
16
+
15
17
let group = self . chunk_formatter ( ) . format_global ( let_statement, visibility) ;
16
18
self . write_indentation ( ) ;
17
19
self . format_chunk_group ( group) ;
@@ -99,4 +101,13 @@ mod tests {
99
101
let expected = "pub comptime mut global x: Field = 1;\n " ;
100
102
assert_format ( src, expected) ;
101
103
}
104
+
105
+ #[ test]
106
+ fn format_global_with_attributes ( ) {
107
+ let src = " #[abi ( foo ) ] global x = 1 ; " ;
108
+ let expected = "#[abi(foo)]
109
+ global x = 1;
110
+ " ;
111
+ assert_format ( src, expected) ;
112
+ }
102
113
}
You can’t perform that action at this time.
0 commit comments