You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The StringGetOwnProperty operation used when indexing a string ("abc"[1]) does not produce the same string that the lexer produces. This matters for UTF16 surrogates.
Currently the lexer uses String::from_utf16_lossy (see UTF16CodeUnitsBuffer::to_string_lossy) and StringGetOwnProperty uses char::from_u32(u32::from(utf16_val)).map_or_else(|| Value::from(format!("\\u{:x}", utf16_val)), Value::from) (ignore the conversion to Value).
To Reproduce
This JavaScript code reproduces the issue:
Describe the bug
The
StringGetOwnProperty
operation used when indexing a string ("abc"[1]
) does not produce the same string that the lexer produces. This matters for UTF16 surrogates.Currently the lexer uses
String::from_utf16_lossy
(seeUTF16CodeUnitsBuffer::to_string_lossy
) and StringGetOwnProperty useschar::from_u32(u32::from(utf16_val)).map_or_else(|| Value::from(format!("\\u{:x}", utf16_val)), Value::from)
(ignore the conversion toValue
).To Reproduce
This JavaScript code reproduces the issue:
Expected behavior
Both should produce the same strings, because the spec expects them to be equal.
Build environment:
The text was updated successfully, but these errors were encountered: