Repository navigation
-mm=own: casts to any keep field families; interface slots are a method's callers - #721
Merged
Merged
Conversation
…od's callers Two callback families stayed open that need not (own spec 59): - A class's callback field once an object of the class became `any`, a union, `unknown` or `object`. Every way back to the field is a cast to the class (an unbox, a union narrowed by instanceof), whose `ts.PropertyRef` the family sees here; another module can cast back only to a class it names, and a class it names is one it can build, which opens the family already. collectFieldFamilies drops the `escaping` set. - A callback parameter of a method an interface's vtable holds. When every slot holding it is closed (interfaceFamilies, spec 31) and it is not interfaceReached, its callers are every call through those slots (interfaceCallsOf), whose arguments join its families with its direct calls'. parameterOf returns a set (FamilyTargets): a value given on through an interface's slot reaches each member, and passes to a closed family only when all of them are. Tests: own_callback_cast and own_callback_interface_slot (own, rc, gc, none; own emits no counting); negatives own_err_callback_cast_field_drops, own_err_callback_interface_slot_drops, own_err_callback_interface_slot_targets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Two callback families under
-mm=ownstayed open that need not (spec §59).A class's callback field after a cast to
any, a union,unknownorobject. The only way back to the field is a cast to the class (an unbox, or a union narrowed byinstanceof), and the family already sees that class'sts.PropertyRefin this module. Another module can cast back only to a class it can name, and the family is already open for such a class (callableFromOutsideof its constructor).collectFieldFamiliesno longer keeps theescapingset.A callback parameter of a method an interface's vtable holds. When every interface slot holding the method is closed (
interfaceFamilies, spec 31) and the method is notinterfaceReached, its callers are every call through those slots (interfaceCallsOf).parameterOfnow returns a set (FamilyTargets): a callback given on through an interface's slot reaches every class that fills it, and counts as given to a closed family only when all of their families are closed.Tests:
own_callback_castandown_callback_interface_slotrun under own, rc, gc and none; own emits no counting for them.own_err_callback_cast_field_drops,own_err_callback_interface_slot_dropsandown_err_callback_interface_slot_targets.Validated on Windows: ctest 6148/6148, and the default library's release tests pass under gc, rc, none and own. Not run on Linux locally.
Not in this PR: arrow functions in object literals given to function-typed fields (
f1({ w: x => x }, 0)). They compile as methods bound to a literal object that nothing owns. Fixing that means changing how MLIRGen builds object-literal arrows, not this pass.🤖 Generated with Claude Code