mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: add error for println('x').abcd
(#15423)
This commit is contained in:
parent
4c0339242a
commit
7280d4c95a
@ -1129,7 +1129,7 @@ pub fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type {
|
||||
if typ == ast.void_type_idx {
|
||||
// This means that the field has an undefined type.
|
||||
// This error was handled before.
|
||||
// c.error('`void` type has no fields', node.pos)
|
||||
c.error('`$node.expr` does not return a value', node.pos)
|
||||
node.expr_type = ast.void_type
|
||||
return ast.void_type
|
||||
}
|
||||
|
3
vlib/v/checker/tests/fn_selector_expr_err.out
Normal file
3
vlib/v/checker/tests/fn_selector_expr_err.out
Normal file
@ -0,0 +1,3 @@
|
||||
vlib/v/checker/tests/fn_selector_expr_err.vv:1:26: error: `println('Hello, World!')` does not return a value
|
||||
1 | println('Hello, World!').whatever
|
||||
| ~~~~~~~~
|
1
vlib/v/checker/tests/fn_selector_expr_err.vv
Normal file
1
vlib/v/checker/tests/fn_selector_expr_err.vv
Normal file
@ -0,0 +1 @@
|
||||
println('Hello, World!').whatever
|
Loading…
Reference in New Issue
Block a user