-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: fix fn call with newline opening brace
- Loading branch information
Showing
2 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// vfmt off | ||
struct Address | ||
{ | ||
pub: | ||
street string | ||
city string | ||
state string | ||
zip int | ||
} | ||
|
||
fn test_fn_call_with_newline_opening_brace() | ||
{ | ||
println(initialized_address) | ||
assert true | ||
} | ||
|
||
struct AddressConfig { | ||
pub: | ||
|
||
street string = '1234 Default St' | ||
city string = 'Your Favorite City' | ||
state string = 'Could Be Any' | ||
zip int = 42 | ||
} | ||
|
||
fn new_address(cfg AddressConfig) &Address | ||
{ | ||
return &Address | ||
{ | ||
street:cfg.street | ||
city:cfg.city | ||
state:cfg.state | ||
zip:cfg.zip | ||
} | ||
} | ||
|
||
const ( | ||
default_address = new_address(AddressConfig{}) | ||
initialized_address = new_address | ||
( | ||
street: '0987 tluafeD tS' | ||
city: 'ytiC etirovaF rouY' | ||
state: 'ynA eB dluoC' | ||
zip: 24 | ||
) | ||
) | ||
|
||
fn (a Address) str() string { | ||
return 'Address.str(): $a.street, $a.city, $a.state $a.zip' | ||
} | ||
// vfmt on |