Repository navigation
WIP5 - #169
Draft
charlespwd wants to merge 1 commit into
Draft
WIP5#169charlespwd wants to merge 1 commit into
charlespwd wants to merge 1 commit into
Conversation
Closed
This branch has not been deployed
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
Add conformance cases for native array literals, with existing Array consumers as the compatibility reference.
Problem
The parent parser rejects a leading
[in templates. Adding constructors needs explicit expected results and fixed expectations for existing successful rendering.Solution
The cases cover construction, nesting, trailing commas, expression-valued elements and the existing expression-taking consumers. Preservation expectations come from the pinned parent; new literal results use the approved contract and equivalent environment-Array results.
Paired implementation: Shopify/liquid#2134, on the shared-for stack.
Ruby API migration
Remove
reject_bare_brackets:fromParser.newcalls. The shared parser now has one leading-bracket grammar, including inContext#[]:context['[key]']evaluates an array containing the value ofkey.context['self[key]']for the indirect variable lookup previously expressed by bare brackets.Existing native-template results stay unchanged. Typed legacy lookup-string APIs remain separate; this change does not add a replacement parser mode.
Feature boundary
Outcome
Construct an Array directly with
[]or[expression, ...]wherever the native parser accepts an expression.Scope
Context#[]now use the same array grammar for leading brackets;self[...]remains explicit lookup.Acceptance boundary
specs/liquid_ruby/array_literals.ymlcontains the approved preservation, constructor and malformed-input cases.test/integration/array_literal_test.rb.[1, 2][0]remain syntax errors.Non-goals
Hash literals, mixed array/hash literal nesting, arithmetic, filtered parentheses, interpolation, new postfix grammar and changes to for-argument separators.
Dependencies
liquid-factory-shared-expressions-in-forat372f77cbebd9c9c5319d967a1a988d7c5878b225.736ebca7b4377dbd8bf59232649fa00c69b21ea3.The cases are examples, not proof that every possible template preserves its output.