{{ message }}
Repository navigation
fix(tokenizer): invalidate cached ASTs after source edits - #1082
Merged
Merged
Conversation
Keep a snapshot of source lines for deferred cache hashing so caller mutations cannot make a stale AST appear current. Cover the tokenizer cache miss and subsequent hit after an edit and verify the public compiler exports the updated function value. Fixes 8f4e#1057 Prepared with Codex assistance.
irimias57
approved these changes
Oct 17, 2026
irimias57
left a comment
Member
There was a problem hiding this comment.
Thank you for the contribution, Nigel! This is a clean, focused fix for the cache invalidation bug, and the tokenizer-level plus public compiler regressions cover the behavior very well. Nicely done!
andorthehood
approved these changes
Oct 17, 2026
Member
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.

The AST cache now keeps a copy of the source lines used to parse each block. Editing the caller's array no longer makes stale code look unchanged.
Added a tokenizer regression that checks the edited source is a cache miss and the next unchanged compile is a hit. A compiler regression also runs the exported WebAssembly function and checks that it returns 2 after the edit.
Both regressions failed before the fix and pass with it. All 748 tokenizer and compiler tests pass. All affected lint checks and type checks and tests also pass.
Fixes #1057
Prepared with Codex assistance.