Bind Self to the conformance target; add ce.conformsTo — Fix #362 - #366
Merged
Merged
Conversation
…rgument's static type; update Appendix A and add mixed-subtype regression tests. Part of cortex-js#362
…rnal conformance oracle; regenerate api.md. Part of cortex-js#362
enumeratio
force-pushed
the
protocol-self-target
branch
from
September 29, 2026 21:22
24e1447 to
f6bf0ac
Compare
Contributor
Author
|
Pushed a review pass:
This PR doesn't slow member calls on its own. Combined with #365 they stay at #365's cost. |
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.
Fix #362
Selfin a protocol member's signature now binds to the conformance target that dispatch selects for the receiver (the most specific applicable edge, asbestCandidatespicks it), not the receiver's own static type. WithCompare: "(Self, Self) -> number"onreal,Compare(5, 1/2)andCompare(3, 2.5)were rejected while the reverse orders passed; all four now pass, both at canonicalization and at run time, and a-> Selfresult binds the same way. Arguments are still checked against the target, not a join of their types, so a string argument or a non-conforming nominal type is still refused. Compile already groundedSelfat the target, so it's unchanged. Appendix A ofTYPE_SYSTEM_ROADMAP.mdis updated.ce.conformsTo(type, protocol)is the public counterpart of the resolver's internalconformsTo, including conditional conformances. It sits next todeclareProtocol, andapi.mdis regenerated.Protocol refinement is left as a separate exploration, as you suggested.