mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
159a9c3070
commit
43fbc68f1e
@ -3711,6 +3711,12 @@ pub fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
|
|||||||
right_len = 0
|
right_len = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if right is ast.InfixExpr {
|
||||||
|
if right.op == .arrow {
|
||||||
|
c.error('cannot use `<-` on the right-hand side of an assignment, as it does not return any values',
|
||||||
|
right.pos)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if node.left.len != right_len {
|
if node.left.len != right_len {
|
||||||
if right_first is ast.CallExpr {
|
if right_first is ast.CallExpr {
|
||||||
|
4
vlib/v/checker/tests/assign_expr_channel_push.out
Normal file
4
vlib/v/checker/tests/assign_expr_channel_push.out
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vlib/v/checker/tests/assign_expr_channel_push.vv:2:9: error: cannot use `<-` on the right-hand side of an assignment, as it does not return any values
|
||||||
|
1 | ch := chan f64{}
|
||||||
|
2 | _ := ch <- 4.56
|
||||||
|
|
|
2
vlib/v/checker/tests/assign_expr_channel_push.vv
Normal file
2
vlib/v/checker/tests/assign_expr_channel_push.vv
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ch := chan f64{}
|
||||||
|
_ := ch <- 4.56
|
Loading…
x
Reference in New Issue
Block a user