Skip to content

Move self handling to variable lookup#2081

Open
jg-rp wants to merge 1 commit intoShopify:mainfrom
jg-rp:alternative-self
Open

Move self handling to variable lookup#2081
jg-rp wants to merge 1 commit intoShopify:mainfrom
jg-rp:alternative-self

Conversation

@jg-rp
Copy link
Copy Markdown
Contributor

@jg-rp jg-rp commented May 6, 2026

This PR shows an alternative implementation of self by removing SelfDrop and moving handling of self from Context to VariableLookup.

This approach changes self semantics to fix the issue identified in #2080. Instead of conditionally replacing self with a drop, we now fall back to top-level variable resolution if self[key] does not exist.

A comforting side effect is that self can no longer be aliased with {% assign this = self %}, or be passed as an argument {% render 'snippet', this: self %} (this does not cause too much of a problem because SelfDrop.context is always replaced with the current context).

(Edit: My assumptions about the intended scoping rules for self might not be quite right.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant