Repository navigation
Conversation
aapoalas
left a comment
There was a problem hiding this comment.
Thank you for the PR, and welcome to the project.
First - LLM coding is mostly welcome, but I'd rather you write your own PR descriptions and comments.
Second - good job on holding the GC correctly! That's often not easy for first-comers.
Third - please don't change the spec text at all. It might be that there's been a spec update in between now and when you made this, but at least some parts seem to have been editorialised by you. We should purely copy and use the spec text as-is. At most what we can do is leave some of it out, though that is also not generally a good idea.
Fourth - there are some issues around cloning of Strings / Vecs which I'd like to see fixed before this is merged.
Fifth - you have to rerun the full -- -u test suite.
…replace/replaceAll
3fdfca3 to
e72bf47
Compare
|
Thanks for the review, and sorry it took me this long to come back to it. I've pushed a new version (e72bf47), rebased on main:
One test, On your first point, to be upfront: I used an AI assistant for both the code changes and this write-up. Everything above was checked against the full test262 run before pushing. I've also replaced the PR description with a shorter, up-to-date one. |
Closes #938.
String.prototype.replaceandreplaceAllwith a stringreplaceValueignored$patterns:"abc".replace("b", "[$&]")returneda[$&]cinstead ofa[b]c.Both now go through
GetSubstitutionwhen the replacement contains a$. Without a$they keep using Rust'sreplace/replacenas before.get_substitutionitself had two bugs that this exposed:$pattern swallowed the rest of the template, so[$&]was never substituted.$'and$`mixed UTF-16 and UTF-8 offsets and could panic on non-ASCII strings.It no longer needs the
regexpfeature gate, since it doesn't use regexes.Test262 (full run with
-u): 20 tests go from FAIL to PASS, none regress.staging/sm/String/replaceAll.jsgoes from FAIL to CRASH: it now gets past the$$checks and reaches"αβ".replace(RegExp("", "g"), …), which also crashes on main (empty regex on a non-ASCII string). That's a separate bug and not touched here.