Skip to content

Add specs for bare-bracket rejection in strict2 and self keyword#124

Draft
aswamy wants to merge 1 commit intomainfrom
bare-bracket-self-keyword
Draft

Add specs for bare-bracket rejection in strict2 and self keyword#124
aswamy wants to merge 1 commit intomainfrom
bare-bracket-self-keyword

Conversation

@aswamy
Copy link
Copy Markdown

@aswamy aswamy commented Mar 20, 2026

Summary

Adds conformance specs for the bare-bracket syntax changes in Shopify/liquid:

Bare-bracket rejection in strict2 (7 specs):

  • {{ ['product'] }}, {{ [key] }} are rejected with parse_error
  • Rejection applies in variables, for, if, case, assign
  • Qualified bracket access (product['title']) and dot notation remain valid

self keyword (8 specs):

  • self['product'] resolves variables through the normal scope chain
  • self[key] performs dynamic variable lookups
  • Works in all parsing modes (lax, strict, strict2)
  • Local assigns ({% assign product = 'local' %}) are visible via self['product']
  • self can be reassigned ({% assign self = 'value' %})
  • Returns empty string for unknown keys
  • Supports nested property access (self['product'].title)

Backwards compatibility (1 spec):

  • Lax mode still allows bare-bracket access

Depends on:

  • Shopify/liquid: #2060
  • Shopify/liquid-rewriter-private: #211

🤖 Generated with Claude Code

- strict2 rejects bare-bracket access (['product'], [key], etc.)
- Qualified bracket access (product['title']) remains valid
- `self` keyword resolves variables through the scope chain
- `self` works in all parsing modes (lax, strict, strict2)
- Local assigns shadow the `self` keyword

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aswamy aswamy added the #gsd:49922 Liquid Array Literal Support label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:49922 Liquid Array Literal Support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant