Repository navigation
WIP4 - #2133
Closed
charlespwd wants to merge 1 commit into
Closed
WIP4#2133charlespwd wants to merge 1 commit into
charlespwd wants to merge 1 commit into
Conversation
This was referenced Oct 27, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Research / WIP
Experimental output from
liquid-factory, shared for design and code feedback. This is a research draft for the WIP3 stack, not a merge-ready language change.In this PR
Let
foruse WIP3 expressions directly for its collection,limitand numericoffset, with or without parentheses.Problem
These expressions already work in
assign. Using one in a loop currently requires a temporary assignment first.Solution
Use
Parser#expressionfor the new forms. Previously accepted forms keep their original interpretation, loop names and continuation keys. That compatibility path matters for existing lookup and range quirks that render differently through the shared AST.Paired specs: Shopify/liquid-spec#168, adding the approved cases in
specs/liquid_ruby/for_shared_expressions.yml. This feature is based on WIP3, notmain.Feature boundary
Outcome
forcollections,limitandoffsetaccept the existing WIP3 expression forms, so a loop can use a grouped or boolean expression without first assigning it to a temporary variable.Scope
limitand numericoffsetvalues use expressions already supported by the WIP3 shared grammar: variable and property/index lookups, literals, ranges, groups, and logical, equality and comparison expressions where their value is meaningful in that position.orandandreturn operands, as they already do outsidefor.limit,offset,reversedandoffset: continuesyntax keeps its meaning. An expression-valued collection must not change the name/metadata or continuation behavior of loops that already succeed.case/whenalternatives keep their existingormeaning.Acceptance boundary
specs/liquid_ruby/for_shared_expressions.ymlstates the approved new results and byte-identical preservation cases.limitandoffset; the cases use existing operand-return behavior and positive integer operands without adding numeric coercion rules. A combined case preserves the collection/limit/offset/reversed boundaries.limitandoffset;offset: continue; reversed order; and empty/elsehandling.whenalternatives remain unchanged. The compatibility case protects their existing meaning while theforgrammar is broadened.Non-goals
offset: continue,reversed, orcase/whenalternatives.Dependencies
cp-boolean-expressions: the existing shared expression grammar and its evaluation behavior. Present at the pinned Liquid baseecf53f7af7749237b639579792e4c681cbd4a480; this run's Liquid PR targets that branch, notmain.aac52d5c55627375ff4e6984d1ce53e53e61afed.These cases are examples, not proof that every possible template keeps its output.