[annotator] admit type_assertion expressions (class-only, #658 step 3)#671
Merged
[annotator] admit type_assertion expressions (class-only, #658 step 3)#671
Conversation
Contributor
Benchmark Results (Linux x86-64)
CLI Tool Benchmarks
|
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.
Before
Type assertions (
x as Foo) were never admitted to the annotator's typeOf cache. Everyas Fooexpression fired a cache miss at codegen time, forcingresolveExpressionTypeRichto recompute a type that's literal in the AST.After
Annotator admits
type_assertionexpressions when:assertedTypepassesisSafelyAnnotatable(no unions, nullable, function types, or inline object shapes)sourceKind === "class"and passesisSafeVariableAnnotationTypeInterface-kind assertions intentionally excluded — an earlier attempt to admit them broke stage 2 self-hosting (same arch-divergence class as #662 member_access). Re-evaluate after Tier 3 #11 (interface concretization pass).
Description
Follows data posted in #658 (comment 2026-04-22): divergence tracer showed 1249 codegen-time miss events for
type_assertion sourceKind=interfaceon chad-native compile, zero hit-diff events anywhere. Class-only subset is the narrowest safe admission. ~25 LOC.Verified with full
npm run verify(stage 2 self-hosting green).Gate-loosen table