V version: latest git
OS: Arch Linux x64
What did you do?
v:='hello'
v[v.last_index('l')]
What did you expect to see?
no errors
What did you see instead?
/tmp/v/lastfail.6607056726981487751.tmp.c: In function ‘main__main’:
/tmp/v/lastfail.6607056726981487751.tmp.c:8005:15: error: incompatible type for argument 2 of ‘string_at’
8005 | string_at(v, string_last_index(v, tos_lit("l")));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| Option_int
/tmp/v/lastfail.6607056726981487751.tmp.c:7497:37: note: expected ‘int’ but argument is of type ‘Option_int’
7497 | static byte string_at(string s, int idx) {
| ~~~~^~~
...
==================
(Use `v -cg` to print the entire error message)
at least a V error should appear. string_last_index returns an Option
Most helpful comment
at least a V error should appear. string_last_index returns an Option