Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax interpolation does not work with double quoted strings #2479

Closed
lenaing opened this issue Oct 21, 2019 · 3 comments
Closed

Syntax interpolation does not work with double quoted strings #2479

lenaing opened this issue Oct 21, 2019 · 3 comments
Assignees
Labels
Bug This tag is applied to issues which reports bugs.
Milestone

Comments

@lenaing
Copy link
Contributor

lenaing commented Oct 21, 2019

V version: V 0.1.21 a29c80c
OS : Linux 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux

What did you do ?
I am used to use double quotes as string delimiters. When I try syntax interpolation, it breaks with double quoted string but works with single quoted ones.

fn main() {
    test := "testing"
    println("${test}")
}

What did you expect to see?

$ v run test.v 
testing

What did you see instead?

$ v run test.v
check()
next token = `eof`
addr2line: 'v': No such file
v(+0x3e6bd) [0x5568e79146bd]
addr2line: 'v': No such file
v(+0x23609) [0x5568e78f9609]
addr2line: 'v': No such file
v(+0x20858) [0x5568e78f6858]
addr2line: 'v': No such file
v(+0x4424c) [0x5568e791a24c]
addr2line: 'v': No such file
v(+0x498da) [0x5568e791f8da]
addr2line: 'v': No such file
v(+0x49296) [0x5568e791f296]
addr2line: 'v': No such file
v(+0x48f3c) [0x5568e791ef3c]
addr2line: 'v': No such file
v(+0x4810c) [0x5568e791e10c]
addr2line: 'v': No such file
v(+0x4842b) [0x5568e791e42b]
addr2line: 'v': No such file
v(+0x42692) [0x5568e7918692]
addr2line: 'v': No such file
v(+0x42400) [0x5568e7918400]
addr2line: 'v': No such file
v(+0x4032a) [0x5568e791632a]
addr2line: 'v': No such file
v(+0x3f9df) [0x5568e79159df]
addr2line: 'v': No such file
v(+0x1f067) [0x5568e78f5067]
addr2line: 'v': No such file
v(+0x3b409) [0x5568e7911409]
addr2line: 'v': No such file
v(+0x2dc03) [0x5568e7903c03]
addr2line: 'v': No such file
v(+0x2e1b7) [0x5568e79041b7]
addr2line: 'v': No such file
v(+0x65f28) [0x5568e793bf28]
addr2line: 'v': No such file
v(+0x67689) [0x5568e793d689]
??:0:                                         | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7fc0b295509b]
addr2line: 'v': No such file
v(+0x249a) [0x5568e78d849a]
test.v:1:0: expected `)` but got `eof`
    1| fn main() {

      ^
    2|     test := "testing"

    3|     println("${test}")

The C temp file seems truncated, (yes, there is really no final brace :)) :

$ tail -10 test.tmp.c 
 }
 ;
 
return  saw != '_' ;
 
 }
 void main__main() {
 
string test= tos3("testing") ;
 
@spytheman
Copy link
Member

spytheman commented Oct 22, 2019

NB: this works:

fn main() {
    test := "testing"
    println('${test}')
    println("$test")
}

but yours does not ...
So the problem is in
println("${test}")
vs
println('${test}')

Thanks for the bug report.

@Tembocs
Copy link

Tembocs commented Nov 16, 2019

I still face this problem in V version V 0.1.22 06a7954.

@medvednikov
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants