checker: fix a compiler panic on `fntest()?(&int,&int){return test()?}`
parent
8830af5c89
commit
b7ca4c1668
|
@ -135,7 +135,7 @@ pub fn (mut c Checker) return_stmt(mut node ast.Return) {
|
||||||
pos)
|
pos)
|
||||||
}
|
}
|
||||||
if exp_type.is_ptr() && got_typ.is_ptr() {
|
if exp_type.is_ptr() && got_typ.is_ptr() {
|
||||||
mut r_expr := &node.exprs[i]
|
mut r_expr := &node.exprs[expr_idxs[i]]
|
||||||
if mut r_expr is ast.Ident {
|
if mut r_expr is ast.Ident {
|
||||||
if mut r_expr.obj is ast.Var {
|
if mut r_expr.obj is ast.Var {
|
||||||
mut obj := unsafe { &r_expr.obj }
|
mut obj := unsafe { &r_expr.obj }
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
vlib/v/checker/tests/return_optional_of_multiple_results.vv:2:9: error: `?` is not needed, use `return test()`
|
||||||
|
1 | fn test() ?(&int, &int) {
|
||||||
|
2 | return test() ?
|
||||||
|
| ~~~~~~
|
||||||
|
3 | }
|
||||||
|
4 |
|
|
@ -0,0 +1,6 @@
|
||||||
|
fn test() ?(&int, &int) {
|
||||||
|
return test() ?
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
Loading…
Reference in New Issue