Settle the constant type as one shape, not two - #417
Draft
Firehed wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #417 +/- ##
=========================================
Coverage 98.62% 98.62%
Complexity 1814 1814
=========================================
Files 128 128
Lines 4571 4571
=========================================
Hits 4508 4508
Misses 63 63 ☔ View full report in Codecov by Harness. |
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.
Without this, S3.8b would have had to decide in-flight whether a global constant gets its own metadata type, its own name type, and its own resolved wrapper. Three near-copies of types that already exist is the duplication this rework removes, so the decision is recorded before the slice that would otherwise make it under pressure.
Docs only. No code changes.
The decision
A constant is one type whether or not a class declares it:
Domain\ConstantInfoserves both.declaringClassbecomes?ClassName, and its absence is what makes a constant global.visibilityandisFinalstay non-nullable. A global constant is mechanically public and final — a redeclaredconstis a fatal and a repeateddefine()is a no-op — so those fields carry the true value, not a placeholder.format()branches on the declaring class alone (public const Xversusconst X).Domain\ConstantNameholds either a member name or an FQN, so theConstantNamethat RFC 1 §5.3 calls for needs no second type. This closes the collision the manifest previously flagged as decide-before-S3.8b.ResolvedMember. That interface means reached through a class, via->or::, which a global constant has no path for. SoConstantInfoimplementsResolvedSymbolitself rather than gaining a fifth thin wrapper — also a down payment on the wrapper collapse in Decide whether Domain *Info and Resolution Resolved* should become one set of objects #416.Net new types needed to represent global constants: zero.
Where it lands
0002-execution-plan.md§5.3 (the name-type model) carries the decision.build-manifest.md's note under the JIT name-type bullet is rewritten from posing the question to recording the answer.Plan step: 0002 §5.3, feeding S3.8b's acceptance. RFC section: RFC 1 §5.1 (concrete return types per kind), §5.3.
Checklist
ConstantNamecollision the manifest deferred is resolved, not restatedSymbolCoverageGridTest's registry parse is unaffectedCandidate closes (pending review verification): none.