Closed
Description
I've hit this issue, but am struggling to create a compact reproduction - here's a brief summary.
See this PR ColinEberhardt/assemblyscript-regex#12
I'm hitting the following error at runtime:
RuntimeError: unreachable
at assembly/nfa/matcher/Matcher#matches@virtual (wasm-function[240]:1)
at assembly/nfa/matcher/CharacterSetMatcher#matches~anonymous|0 (wasm-function[241]:19)
at ~lib/array/Array<assembly/nfa/matcher/Matcher>#some (wasm-function[242]:85)
at assembly/nfa/matcher/CharacterSetMatcher#matches (wasm-function[244]:21)
at assembly/nfa/nfa/MatcherState<assembly/nfa/matcher/CharacterSetMatcher>#matches (wasm-function[245]:8)
at assembly/nfa/nfa/State#matches@virtual (wasm-function[250]:58)
at assembly/regexp/recursiveBacktrackingSearch (wasm-function[184]:121)
at assembly/regexp/recursiveBacktrackingSearch@varargs (wasm-function[185]:56)
at assembly/regexp/RegExp#exec (wasm-function[192]:307)
I've tried to recreate the issue, by creating a similar runtime state (replicating the various classes etc ...), but in doing so have stumbled on something odd. By adding the code outlined here:
Which basically creates a similar runtime state, the error goes away!
In other words - if I create a CharacterMatcher
, CharacterSetMatcher
, etc ... - execute their matches
function, then throw the result away, everything wrks just fine. If not - I see the above runtime error later on in the code.