Repository navigation
Pin production primary-constructor storage shape - #6048
Conversation
|
Round 1 attempt superseded before reviewer dispatch: the owner text incorrectly said both hosts use AssemblyContextSourceQuery. CLI whole-type decompilation calls MemberBodyProducer.Project directly (ApiCommand), while browser SourceExports reaches the same composer through that query. Correcting this documentation-only path description; no product behavior changes and no review round is spent. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Round 1 candidate: |
|
Round 1 starts at exact head |
Round 1 reconciliationThe production storage-shape foundation is review-clean without adding Reviewed head:
All three reviewed the complete authored diff in isolated fixed-head worktrees. Non-blocking observation: derived
|
Pins a reliable production source-shape foundation for CSharp memory-safety
spelling without adding redundant reconstruction machinery.
Fixes #6046; advances the narrow source-shape prerequisite in #5255 for #5257.
Overall tracker: #5226.
Card revision:
027256b4ffd5e6f20b4193e0ae06a21a182bc2f8.Change
Conclusion: REVIEW — production already emits explicit fields and ordinary
constructors. This change records the Decompiler-owned contract and adds
compiler-produced regression evidence; it does not change product output.
The normative owner is
docs/design/memory-safety-modes.md, Primary-constructorstorage shape. CSharp independently owns declaration modifiers. There is no
new raise, fallback API, host-local policy, or compile-back-planner rewrite.
Demo
The new updated-rules fixture begins with a primary constructor and an explicitly
safe, offset-bearing field:
The production CLI at the card revision, using
typewith-S "Decompiled Source" --bare, produces:The field and ordinary constructor remain separate declaration sites.
This is source-shape evidence, not completed v2 spelling: the missing
safeis the pre-existing #5257 work. No claim is made that this output alreadycompiles under updated semantics.
The ordinary-capture neighbor remains unchanged:
The second new fixture covers an updated-rules explicit-layout struct whose
pointer-free field has an explicit unsafe caller contract. Its declaration and
parameter store remain explicit too.
Evidence
dotnet build dotnet-inspect.slnx -c Release -m:2 -p:UseSharedCompilation=false -v:qsucceeded.PrimaryConstructorStorageTestsobserves the first product projection:explicit fields, offsets, readonly state, ordinary constructor parameters,
and parameter-dependent assignments. It parses but does not repair source.
stores before nontrivial base constructors; no ordering behavior changes.
npx markdownlint-cli docs/design/memory-safety-modes.mdpassed.authored diff contains one owner-document section, inspected fixture source,
and product-outcome tests, with no raise/printer/product changes.
Compatibility and remaining work
The existing three-stage #5226 adoption stays: Metadata facts, shared CSharp
adoption, then CLI and browser/Wasm outcome gates. CLI whole-type decompilation
calls
MemberBodyProducer.Projectdirectly inApiCommand; browserSourceExports.QueryTypeSourceCorereaches the same composer throughAssemblyContextSourceQuery. No new adoption stage, dependency, platformexception, or rendering architecture is introduced.
Required
safe/unsafespelling, extended-layout declaration legality, andwhole-output v2 compilation remain unverified by this slice and stay with
#5257/#5255. Generated-name authentication remains #5595. The harness's primary
constructor synthesis is not presented as production support.