V: panic: string.v:642 on using println() in repl

Created on 1 Jul 2019  路  6Comments  路  Source: vlang/v

V version:
V 0.1.10
OS:
Ubuntu 18.10

What did you do?

~/v$ ./v
V 0.1.10
Use Ctrl-D or `exit` to exit
For now you have to use println() to print values, this will be fixed soon

>>> println('hello world')

What did you expect to see?
'hello world'

What did you see instead?

panic: string.v:642
expected type `[]int`, but got `int`
~/v$ 
Bug

All 6 comments

Have you tried to pull from git, and recompile using make clean all ?

Hello, I tried on my computer with a fresh installation and it worked. Are you sure you are up to date with master ?

Can you give us more insight about this bug ?

i got the same problem锛宨 use the 銆恗ake clean all銆戯紝and the result is successful

rm -f v.c v vprod
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
cc -march=native -std=gnu11 -w -o v v.c
./v -o v compiler
rm v.c
V has been successfully built

but run println('hello world')锛宎lso wrong

panic: string.v:642
expected type `[]int`, but got `int`

sorry for late reply, same error as @zhou26192619

@skasyn once I try to print some srting, the repl unplanned exits and gives error message as in original post

tried pulling fresh installation from source - v. 0.1.11 - different error:

samir@d:~$ git clone https://github.com/vlang/v
Cloning into 'v'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 2199 (delta 19), reused 37 (delta 14), pack-reused 2147
Receiving objects: 100% (2199/2199), 1.32 MiB | 952.00 KiB/s, done.
Resolving deltas: 100% (1293/1293), done.
samir@d:~$ cd v
samir@d:~/v$ make
rm -f v.c v vprod
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
cc -std=gnu11 -w -o v v.c
./v -o v compiler
rm v.c
V has been successfully built
samir@d:~/v$ ./v
V 0.1.11
Use Ctrl-D or `exit` to exit
For now you have to use println() to print values, this will be fixed soon

>>> println ("s")
(char code=34) pos=0 len=17
panic: vrepl.v:1
invalid character `"`, use ' to denote strings
samir@d:~/v$ 

when using single quote it runs as expected

" quotes are not supported yet, the original error is fixed, as I understand?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taojy123 picture taojy123  路  3Comments

penguindark picture penguindark  路  3Comments

lobotony picture lobotony  路  3Comments

radare picture radare  路  3Comments

choleraehyq picture choleraehyq  路  3Comments