mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
scanner: fix string interpolation with match expr (#18969)
This commit is contained in:
parent
e03c0329c1
commit
b35ad8a657
@ -808,7 +808,7 @@ fn (mut s Scanner) text_scan() token.Token {
|
||||
}
|
||||
`{` {
|
||||
// Skip { in `${` in strings
|
||||
if s.is_inside_string {
|
||||
if s.is_inside_string || s.is_enclosed_inter {
|
||||
if s.text[s.pos - 1] == `$` {
|
||||
continue
|
||||
} else {
|
||||
|
15
vlib/v/tests/string_interpolation_match_expr_test.v
Normal file
15
vlib/v/tests/string_interpolation_match_expr_test.v
Normal file
@ -0,0 +1,15 @@
|
||||
fn test_string_interpolation_match_expr() {
|
||||
x := 0
|
||||
|
||||
println('Hello ${match x {
|
||||
0 { 'John' }
|
||||
1 { 'George' }
|
||||
else { 'Others' }
|
||||
}}')
|
||||
|
||||
assert '${match x {
|
||||
0 { 'John' }
|
||||
1 { 'George' }
|
||||
else { 'Others' }
|
||||
}}' == 'John'
|
||||
}
|
Loading…
Reference in New Issue
Block a user