checker: add test for empty #flag node, (fix #14291) (#14447)

Larpon 2022-05-18 12:38:58 +02:00 committed by Jef Roosens
parent 88c4e8db29
commit 21308289ad
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 7 additions and 0 deletions

View File

@ -2460,6 +2460,9 @@ fn (mut c Checker) hash_stmt(mut node ast.HashStmt) {
'flag' {
// #flag linux -lm
mut flag := node.main
if flag == 'flag' { // Checks for empty flag
c.error('no argument(s) provided for #flag', node.pos)
}
if flag.contains('@VROOT') {
// c.note(checker.vroot_is_deprecated_message, node.pos)
flag = util.resolve_vmodroot(flag.replace('@VROOT', '@VMODROOT'), c.file.path) or {

View File

@ -0,0 +1,3 @@
vlib/v/parser/tests/hash_empty_flag_value.vv:1:1: error: no argument(s) provided for #flag
1 | #flag
| ~~~~~

View File

@ -0,0 +1 @@
#flag