Skip to content

Conversation

@charlespwd
Copy link
Contributor

@charlespwd charlespwd commented Dec 3, 2025

Features

  • Add support for boolean expressions everywhere
    • As variable output {{ a or b }}
    • As filter argument {{ collection | where: 'prop', a or b }}
    • As tag argument {% render 'snip', enabled: a or b %}
    • As conditional tag argument {% if cond %} (extending previous behaviour)
  • Add support for subexpression prioritization and associativity
    • In ascending order of priority:
      • Logical: and, or (right to left)
      • Equality: ==, !=, <> (left to right)
      • Comparison: >, >=, <, <=, contains (left to right)
      • Groupings: ( expr )
    • For example, this is now supported
      • {{ a > b == c < d or e == f }} which is equivalent to
      • {{ ((a > b) == (c < d)) or (e == f) }}
  • Add support for parenthesized expressions
    • e.g. (a or b) == c

Notable passing test

  def test_assign_boolean_expression_assignment
    assert_template_result(
      'it rendered',
      <<~LIQUID,
        {%- assign should_render = a == 0 or (b == 1 and c == 2) -%}
        {%- if should_render -%}
          it rendered
        {%- endif -%}
      LIQUID
      { 'b' => 1, 'c' => 2 },
    )
  end

@charlespwd charlespwd force-pushed the cp-boolean-expressions branch 5 times, most recently from ccb81f8 to f62b920 Compare December 5, 2025 14:59
@charlespwd charlespwd force-pushed the cp-boolean-expressions branch from f62b920 to a33443c Compare December 5, 2025 16:40
@charlespwd charlespwd force-pushed the cp-expression-refactor branch 2 times, most recently from 34101f9 to 806c613 Compare January 14, 2026 14:56
@charlespwd charlespwd force-pushed the cp-expression-refactor branch from 806c613 to 1cb61d0 Compare January 26, 2026 16:06
@charlespwd charlespwd force-pushed the cp-boolean-expressions branch from a33443c to 4fcd443 Compare January 27, 2026 14:59
@charlespwd charlespwd force-pushed the cp-expression-refactor branch from 1cb61d0 to 6f03452 Compare January 27, 2026 15:00
@charlespwd charlespwd force-pushed the cp-boolean-expressions branch from 4fcd443 to 3b13ee0 Compare January 27, 2026 15:08
- Use right-recursive descent for proper RTL precedence
- Add bin/liquid-spec-all-adapters for CI workflow
- Update CI to use dedicated script

Fixes 128 precedence test failures from original implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant