elsif inside else does not raise errors when parsing
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
{% assign randomNumber = first_name | size | modulo: 3 | plus: 1 %}
{% if randomNumber == 1 %}
Test
{% else %}
{% elsif randomNumber == 2 %}
Test 2
{% else %}
Test 3
{% endif %}
In the following example, the user added an elsif inside an else block, whcih should be considered invalid.
However, when this block runs it doesn't return anything.
Liquid::Template.parse(stage.body, error_mode: :strict) --> works without any error when it should.
When rendering the result above, fails to run this block.
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 by reproducing the supplied template with Liquid::Template.parse(..., error_mode: :strict) and confirm that the invalid elsif inside else is accepted. Trace the parser handling for else and elsif, then add a regression test in the relevant parser or error-mode test suite. Done means strict parsing raises an error for this structure and valid conditional branches still parse.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100