nitely / nim-regex

Pure Nim regex engine. Guarantees linear time matching
https://nitely.github.io/nim-regex/
MIT License
225 stars 20 forks source link

JS target error on Nim 1.6 #123

Closed nitely closed 10 months ago

nitely commented 11 months ago
$ nim js -r src/regex.nim
Hint: used config file '/home/esteban/.choosenim/toolchains/nim-1.6.14/config/nim.cfg' [Conf]
Hint: used config file '/home/esteban/.choosenim/toolchains/nim-1.6.14/config/config.nims' [Conf]
...........................................................................................fatal.nim(54)            sysFatal
Error: unhandled exception: types.nim(1738, 11) `ty.kind in {tyTuple, tyObject}`  [AssertionDefect]
nitely commented 11 months ago

Whatever this is seems to be fixed in Nim 2.0.0

Ethosa commented 11 months ago

Reason is https://github.com/nitely/nim-regex/blob/master/src/regex/nfatype.nim#L229

Ethosa commented 11 months ago

distinct keyword throws this exception in Nim < 2.0.0 https://github.com/nim-lang/Nim/issues/20227

Ethosa commented 11 months ago

@nitely it's possible to remove distinct keyword and create a new object with same fields? I can send PR to fix this bug.

nitely commented 11 months ago

It's a Nim regression. It works fine in Nim 1.0.10 and 1.2.12.

And I don't think you can fix it in nim-regex because the distinct is needed, IIRC, but you can try.