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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

str.runes() fails on the JavaScript backend #20500

Open
justinas opened this issue Jan 11, 2024 · 0 comments
Open

str.runes() fails on the JavaScript backend #20500

justinas opened this issue Jan 11, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs. Unit: JS Bugs/feature requests, that are related to the JavaScript backend.

Comments

@justinas
Copy link

justinas commented Jan 11, 2024

Describe the bug

The runes() method call crashes in code generated by the JS backend.

Reproduction Steps

foo := "hello馃巺".runes()
println(foo)

Expected Behavior

Expected both C and JS backends to produce the same output.

Current Behavior

$ v run runes.v    # runs okay
[`h`, `e`, `l`, `l`, `o`, `馃巺`]
$ v -o runes.js runes.v && node runes.js
/home/justinas/vlang-testcases/runes.js:3963
                                let r = new rune(new u8('0')); r = new rune(s.str[i.val].charCodeAt())
                                                                                         ^

TypeError: Cannot read properties of undefined (reading 'charCodeAt')
    at string_runes (/home/justinas/vlang-testcases/runes.js:3963:62)
    at js_main (/home/justinas/vlang-testcases/runes.js:6022:15)
    at /home/justinas/vlang-testcases/runes.js:6079:25

Node.js v18.18.2

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.4 ac2dcc2

Environment details (OS name and version, etc.)

NixOS 23.11 (Tapir)

Note

You can use the 馃憤 reaction to increase the issue's priority for developers.

Please note that only the 馃憤 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@justinas justinas added the Bug This tag is applied to issues which reports bugs. label Jan 11, 2024
@felipensp felipensp added the Unit: JS Bugs/feature requests, that are related to the JavaScript backend. label Jan 13, 2024
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. Unit: JS Bugs/feature requests, that are related to the JavaScript backend.
Projects
None yet
Development

No branches or pull requests

2 participants