File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -601,6 +601,20 @@ fn (mut p Parser) mark_last_call_return_as_used(mut last_stmt ast.Stmt) {
601
601
}
602
602
}
603
603
}
604
+ ast.InfixExpr {
605
+ // last stmt has infix expr with CallExpr: foo()? + 'a'
606
+ mut left_expr := last_stmt.expr.left
607
+ for {
608
+ if mut left_expr is ast.InfixExpr {
609
+ left_expr = left_expr.left
610
+ continue
611
+ }
612
+ if mut left_expr is ast.CallExpr {
613
+ left_expr.is_return_used = true
614
+ }
615
+ break
616
+ }
617
+ }
604
618
else {}
605
619
}
606
620
}
Original file line number Diff line number Diff line change
1
+ fn test_main () {
2
+ assert some_func2 (14 )? + 'c' == 'aabcac'
3
+ }
4
+
5
+ fn some_func (i int ) ? string {
6
+ return 'a'
7
+ }
8
+
9
+ fn some_func2 (i int ) ? string {
10
+ return match i {
11
+ 12 { some_func (1 )? + 'b' }
12
+ 13 { some_func (1 )? + 'b' + 'c' }
13
+ 14 { 'a' + some_func (1 )? + 'b' + 'c' + some_func (1 )? }
14
+ else { none }
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments