File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -4166,11 +4166,11 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
41664166}
41674167
41684168fn (mut g Gen) concat_expr (node ast.ConcatExpr) {
4169- mut styp := g.typ (node.return_type)
4169+ mut styp := g.typ (node.return_type. clear_flag (.optional). clear_flag (.result) )
41704170 if g.inside_return {
4171- styp = g.typ (g.fn_decl.return_type)
4171+ styp = g.typ (g.fn_decl.return_type. clear_flag (.optional). clear_flag (.result) )
41724172 } else if g.inside_or_block {
4173- styp = g.typ (g.or_expr_return_type)
4173+ styp = g.typ (g.or_expr_return_type. clear_flag (.optional). clear_flag (.result) )
41744174 }
41754175 sym := g.table.sym (node.return_type)
41764176 is_multi := sym.kind == .multi_return
Original file line number Diff line number Diff line change 1+ struct Aa {
2+ x string
3+ }
4+
5+ struct Bb {
6+ a int
7+ }
8+
9+ fn give (succ Aa) ? (Aa, Bb) {
10+ return match succ.x {
11+ 'x' {
12+ succ, Bb{}
13+ }
14+ else {
15+ error ('nok' )
16+ }
17+ }
18+ }
19+
20+ fn test_fn_with_opt_of_multi_return () {
21+ res , _ := give (Aa{ x: 'x' }) or { panic ('got unexpected err' ) }
22+
23+ assert res.x == 'x'
24+ println ('success' )
25+ }
You can’t perform that action at this time.
0 commit comments