Shopify / liquid-c

Liquid performance extension in C.
MIT License
120 stars 25 forks source link

Raise a syntax error for an invalid range literal for ruby liquid parity #179

Closed dylanahsmith closed 2 years ago

dylanahsmith commented 2 years ago

cc @charlespwd

Problem

https://github.com/Shopify/liquid/pull/1607 fixed an exception during parsing, turning it into a proper Liquid::SyntaxError. However, that expression parsing had been ported to liquid-c, which had the same issue.

Solution

Use rb_check_funcall to handle the case where a literal range bound value doesn't respond to to_i and raise the same syntax error.

I'll open a corresponding liquid PR to fix the testing of this error.