cgen: fix optional functions that return other optional functions
parent
b2f05e56b8
commit
74616d2900
|
@ -1322,7 +1322,7 @@ fn (g mut Gen) return_statement(it ast.Return) {
|
||||||
else if it.exprs.len == 1 {
|
else if it.exprs.len == 1 {
|
||||||
g.write(' ')
|
g.write(' ')
|
||||||
// `return opt_ok(expr)` for functions that expect an optional
|
// `return opt_ok(expr)` for functions that expect an optional
|
||||||
if table.type_is_optional(g.fn_decl.return_type) {
|
if table.type_is_optional(g.fn_decl.return_type) && !table.type_is_optional(it.types[0]) {
|
||||||
mut is_none := false
|
mut is_none := false
|
||||||
mut is_error := false
|
mut is_error := false
|
||||||
expr0 := it.exprs[0]
|
expr0 := it.exprs[0]
|
||||||
|
|
Loading…
Reference in New Issue