mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
4ab72ccb69
commit
c976a691ad
@ -1412,6 +1412,10 @@ fn (mut s Scanner) ident_char() string {
|
||||
if u.len != 1 {
|
||||
if escaped_hex || escaped_unicode {
|
||||
s.error('invalid character literal `$orig` => `$c` ($u) (escape sequence did not refer to a singular rune)')
|
||||
} else if u.len == 0 {
|
||||
s.add_error_detail_with_pos('use quotes for strings, backticks for characters',
|
||||
lspos)
|
||||
s.error('invalid empty character literal `$orig`')
|
||||
} else {
|
||||
s.add_error_detail_with_pos('use quotes for strings, backticks for characters',
|
||||
lspos)
|
||||
|
12
vlib/v/scanner/tests/empty_character_literal_err.out
Normal file
12
vlib/v/scanner/tests/empty_character_literal_err.out
Normal file
@ -0,0 +1,12 @@
|
||||
vlib/v/scanner/tests/empty_character_literal_err.vv:2:8: error: invalid empty character literal ``
|
||||
1 | fn main() {
|
||||
2 | a := ``
|
||||
| ^
|
||||
3 | println(a)
|
||||
4 | }
|
||||
vlib/v/scanner/tests/empty_character_literal_err.vv:2:7: details: use quotes for strings, backticks for characters
|
||||
1 | fn main() {
|
||||
2 | a := ``
|
||||
| ^
|
||||
3 | println(a)
|
||||
4 | }
|
4
vlib/v/scanner/tests/empty_character_literal_err.vv
Normal file
4
vlib/v/scanner/tests/empty_character_literal_err.vv
Normal file
@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
a := ``
|
||||
println(a)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user