| 1 | type Foo = Bar | Baz |
| 2 | |
| 3 | struct Bar { |
| 4 | x string |
| 5 | y int |
| 6 | z int |
| 7 | a int |
| 8 | } |
| 9 | |
| 10 | struct Baz { |
| 11 | x string |
| 12 | } |
| 13 | |
| 14 | fn bar_func(bar Bar) {} |
| 15 | |
| 16 | fn foo_func(f Foo) {} |
| 17 | |
| 18 | fn main() { |
| 19 | bar_func(x: 'bar', y: 13, z: 42) |
| 20 | bar_func( |
| 21 | x: 'bar' |
| 22 | y: 13 |
| 23 | z: 42 |
| 24 | ) |
| 25 | foo_func(Baz{ |
| 26 | x: 'Baz as Foo sumtype' |
| 27 | }) |
| 28 | func_from_other_file(val: 'something') |
| 29 | bar_func( |
| 30 | // pre comment |
| 31 | x: 'struct has a pre comment' |
| 32 | ) |
| 33 | bar_func( |
| 34 | x: 'first field' |
| 35 | // comment between fields |
| 36 | y: 100 |
| 37 | ) |
| 38 | bar_func( |
| 39 | x: 'Look! A comment to my right.' // comment after field |
| 40 | ) |
| 41 | func_from_other_file( |
| 42 | xyz: AnotherStruct{ |
| 43 | f: 'here' |
| 44 | } |
| 45 | ) |
| 46 | ui.button( |
| 47 | width: 70 |
| 48 | onclick: fn (a voidptr, b voidptr) { |
| 49 | webview.new_window(url: 'https://vlang.io', title: 'The V programming language') |
| 50 | } |
| 51 | ) |
| 52 | } |
| 53 | |
| 54 | fn trailing_struct_with_update_expr() { |
| 55 | c.error('duplicate const `${field.name}`', Position{ ...field.pos, len: name_len }) |
| 56 | } |
| 57 | |