mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix a compiler panic on fntest()?(&int,&int){return test()?}
This commit is contained in:
parent
8830af5c89
commit
b7ca4c1668
@ -135,7 +135,7 @@ pub fn (mut c Checker) return_stmt(mut node ast.Return) {
|
||||
pos)
|
||||
}
|
||||
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.obj is ast.Var {
|
||||
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
Block a user