Uh oh!
There was an error while loading. Please reload this page.
Allow closures to read a protected base field - #19991
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
T-Gro
left a comment
There was a problem hiding this comment.
🤖 This review was generated by AI (@expert-reviewer agent). Findings may contain inaccuracies — please verify independently.
Nice, surgically-scoped fix for #5302 with strong test coverage (every closure shape, generic derived types, the object-expression soundness hole, the public-field precision case, and the without-feature rejection). The three-layer reasoning — keep the family region during type-check (except in object-expression bodies via eInObjectExpr), refuse the TLR lift in L3, and re-home the closure-bearing member in IlxGen under --realsig- — is coherent and well-commented. Refactoring exprReferencesProtectedILField/isProtectedILFieldSpec out of Optimizer.fs into AccessibilityLogic.fs for reuse is a good move.
No correctness concerns. The only notes below are non-blocking performance nits, both gated behind --langversion:preview (and, in IlxGen, additionally --realsig-), so the impact is narrow.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Addresses review perf nits: the predicate is now invoked per-member (IlxGen) and per-TLR-candidate (SelectTLRVals), not just in the optimizer. Skip descending into a node's subtree once a protected-field access is recorded, bounding the post-hit cost to the current fold frontier instead of a full-tree walk. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes the CheckCodeFormatting CI failure: the multi-parameter MakeTopLevelRepresentationDecisions signature must be laid out one curried argument per line. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Resolve conflicts from the stacked-squash of #19810 (fix-deterministic-strings) plus new main work: - IlxGen.fs: keep #19929's CodegenFileScope/OrderKey redesign + content-derived raw-data naming (supersedes #19810's counter approach); drop main's orphaned PrimeRawDataValueTypeCounter/primedRawTypeCounter. - Thread #19991's importMap/amap through MakeTopLevelRepresentationDecisions (OptimizeInputs, InnerLambdasToTopLevelFuncs .fs/.fsi) and keep its protected-base-field guard in GenMethodForBinding. - CompilerGlobalState.fs: drop duplicate FreshCompilerGeneratedNameInScope. - Keep valSourceOrderKey sort form; keep seq-vs-par CI leg; merge DeterministicTests to Guid temp dir + 10 iterations + try/finally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes#5302
Object expressions stay the boundary — the override body is a separate type, not nested under
DerivedClass:--langversion:preview