[ARCHIVE] Typed-expression AST infrastructure (saved for future revival) - #3
Closed
milyin wants to merge 3 commits into
Closed
[ARCHIVE] Typed-expression AST infrastructure (saved for future revival)#3milyin wants to merge 3 commits into
milyin wants to merge 3 commits into
Conversation
Owner
Author
|
Superseded by #4. This branch's PR diff didn't show the AST because GitHub diffs against the merge-base, which already contained it. #4 restores the AST on top of current (AST-free) main so the full infrastructure is visible as an additive diff. The raw pre-cleanup source remains preserved on branch |
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.
Purpose — preservation, not merge
This PR archives the typed-expression AST infrastructure so it is not lost when PR #2 (
cleanup/remove-unused-ast-infrastructure) deletes it frommain.It is intentionally not meant to be merged as-is — mergeability and CI are not a concern. It exists as a durable, reviewable reference so the AST work can be revived later when an emitter is ready to build typed trees instead of raw
KtCodestrings.What this branch preserves
The complete
exprmodule and its integration points:ExprArena— ownership/provenance tracker for expression binders. AllocatesBindingIds per-arena;graftalpha-remaps when composing trees from different arenas, making variable capture structurally impossible.KtExpr/KtStmt/KtLambda/KtLiteral/KtPattern— the typed Kotlin expression/statement AST.BindingId/ArenaId/Binder/Spelling/NameHint— binder identity and rendering-name machinery (Fixedfor API-surface parameter names,Freshfor renderer-allocated locals).fill_hole,substitute,free_names,has_hole.ExprSlot<T>,Ast<T>,AnnotationSlot,KtAnnotation,StaticAnnotationText,KtAccessor,AccessorTree, andKtFun::typed_body— the exclusiveLegacy(text)vsAst(tree)sums that let declarations carry either raw text or typed trees.Why it was removed from the mainline
No emitter (
prebindgen-jnior any other consumer) constructs typed trees yet — the entire tier was#[allow(dead_code)]infrastructure staged ahead of its consumers. PR #2 removes it to keep the shipping public API minimal. This archive keeps the design and its tests recoverable.Also included
598e19d— validate function overloads by parameter-type lists inmerge_files(independent of the AST work).How to revive
Branch from here (or cherry-pick the
exprmodule back) once a code generator is ready to emit typed expression trees, then re-wire theExprSlot/AnnotationSlot/KtAccessorbridges into the model.