Skip to content

Commit 37b0ede

Browse files
committed
Strict2 rejection specs point to self['...'] in error message and hints
All 7 strict2 bare-bracket rejection specs now: - Check error message contains 'self' (liquid-ruby's error says 'Use self[\'...\'] instead') - Hints point to self['...'] as the replacement syntax Full error-mode matrix verified (Ruby liquid + JSON-RPC): Lax: 15 failures (strict2 specs fail — lax allows bare brackets) Strict: 101 failures (lax recovery specs fail — strict rejects) Strict2: 188 failures (lax+strict specs fail — strict2 rejects) Both adapters match exactly: 15/101/188 failures in each mode. Declared-mode suite: 0 failures on both adapters. 7 verifiers pass. 92 unit tests pass.
1 parent b81c90d commit 37b0ede

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

specs/liquid_ruby/bare_bracket_self.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,31 @@
1414
errors:
1515
parse_error:
1616
- "Bare bracket access is not allowed"
17+
- "self"
1718
hint: |
1819
In strict2 mode, bare-bracket access like ['product'] is rejected.
19-
The parser should raise a SyntaxError when it encounters an open
20-
square bracket at the start of an expression.
20+
The error message points to self['...'] as the replacement.
21+
Use self['product'] instead — it resolves the variable through the
22+
normal scope chain.
2123
2224
- name: strict2_rejects_bare_bracket_double_quoted
2325
template: '{{ ["product"] }}'
2426
error_mode: strict2
2527
errors:
2628
parse_error:
2729
- "Bare bracket access is not allowed"
30+
- "self"
2831
hint: |
2932
Double-quoted bare-bracket access is also rejected in strict2 mode.
33+
Use self["product"] instead.
3034
3135
- name: strict2_rejects_bare_bracket_dynamic_lookup
3236
template: "{{ [key] }}"
3337
error_mode: strict2
3438
errors:
3539
parse_error:
3640
- "Bare bracket access is not allowed"
41+
- "self"
3742
hint: |
3843
Dynamic variable lookup via bare brackets is rejected in strict2 mode.
3944
Use self[key] instead.
@@ -44,35 +49,43 @@
4449
errors:
4550
parse_error:
4651
- "Bare bracket access is not allowed"
52+
- "self"
4753
hint: |
4854
Bare brackets in for loop collections are rejected in strict2 mode.
55+
Use self['collection'] instead.
4956
5057
- name: strict2_rejects_bare_bracket_in_if
5158
template: "{% if ['product'] == true %}hello{% endif %}"
5259
error_mode: strict2
5360
errors:
5461
parse_error:
5562
- "Bare bracket access is not allowed"
63+
- "self"
5664
hint: |
5765
Bare brackets in if conditions are rejected in strict2 mode.
66+
Use self['product'] instead.
5867
5968
- name: strict2_rejects_bare_bracket_in_case
6069
template: "{% case ['product'] %}{% when 'a' %}hello{% endcase %}"
6170
error_mode: strict2
6271
errors:
6372
parse_error:
6473
- "Bare bracket access is not allowed"
74+
- "self"
6575
hint: |
6676
Bare brackets in case expressions are rejected in strict2 mode.
77+
Use self['product'] instead.
6778
6879
- name: strict2_rejects_bare_bracket_in_assign
6980
template: "{% assign x = ['product'] %}"
7081
error_mode: strict2
7182
errors:
7283
parse_error:
7384
- "Bare bracket access is not allowed"
85+
- "self"
7486
hint: |
7587
Bare brackets in assign values are rejected in strict2 mode.
88+
Use self['product'] instead.
7689
7790
- name: strict2_accepts_qualified_bracket_access
7891
template: "{{ product['title'] }}"

0 commit comments

Comments
 (0)