fmt: insert space in front of `?` for propagation (#6250)

pull/6262/head
Uwe Krüger 2020-08-29 01:56:43 +02:00 committed by GitHub
parent 1bf7e1596b
commit 4d425b0e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -1635,7 +1635,7 @@ propagate the error:
import net.http import net.http
fn f(url string) ?string { fn f(url string) ?string {
resp := http.get(url)? resp := http.get(url) ?
return resp.text return resp.text
} }
``` ```

View File

@ -1136,7 +1136,7 @@ pub fn (mut f Fmt) or_expr(or_block ast.OrExpr) {
} }
} }
.propagate { .propagate {
f.write('?') f.write(' ?')
} }
} }
} }

View File

@ -1,3 +1,3 @@
fn opt_propagate() ?int { fn opt_propagate() ?int {
eventual_wrong_int()? eventual_wrong_int() ?
} }

View File

@ -14,7 +14,7 @@ fn find_all_customers(db sqlite.DB) []Customer {
} }
fn main() { fn main() {
db := sqlite.connect('customers.db')? db := sqlite.connect('customers.db') ?
// select count(*) from Customer // select count(*) from Customer
nr_customers := sql db { nr_customers := sql db {
select count from Customer select count from Customer