Skip to content

transpile: Make paren resolving explicit, consistently use [ ] for indexing#1682

Closed
Rua wants to merge 10 commits intoimmunant:masterfrom
Rua:ast-context-index
Closed

transpile: Make paren resolving explicit, consistently use [ ] for indexing#1682
Rua wants to merge 10 commits intoimmunant:masterfrom
Rua:ast-context-index

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Mar 22, 2026

impl Index<CExprId> for TypedAstContext contains a footgun that caught me off guard: it automatically resolves any Paren expression. Usually that's "the right thing", but it can also silently introduce problems when it unexpectedly skips over an intermediate expression. Additionally, there is no way to avoid this behaviour; TypedAstContext has no method to retrieve the actual expression matching the CExprId.

To avoid that happening in the future and make things more explicit, this PR adds resolve_parens to indexing expressions where it makes sense, and removes the automatic resolving. It also adds a second commit to make everything use [ ] syntax for the sake of consistency.

@Rua Rua closed this Mar 22, 2026
@Rua Rua deleted the ast-context-index branch March 25, 2026 13:38
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