MatchData#end returns invalid offset when called within evalAsync
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 875
- Forks
- 68
- Avg merge
- 9d 5h
- Merged PRs (30d)
- 1
Description
Stackblitz reproduction: https://stackblitz.com/edit/ruby-wasm-demo-78s71k?file=index.html
MatchData#end returns incorrect match offset when used in async context:
vm.eval(/(т)(е)(с)/.match('тест').end(0)) #=> 3
vm.eval(/(т)(е)(с)/.match('тест').end(1)) #=> 1
vm.evalAsync(/(т)(е)(с)/.match('тест').end(0)) #=> 3291
vm.evalAsync(/(т)(е)(с)/.match('тест').end(1)) #=> 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and compare MatchData#end results from eval and evalAsync for the Unicode match. Trace the async path responsible for the offsets; done means evalAsync returns the same offsets as the synchronous calls: 3 for end(0) and 1 for end(1).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, wasm
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100