Repository navigation
Commit fa09b1c
committed
fix(pool): harden pooled view-in-field — this-instance views, semantic IMemoryOwner, this-qualified owner (CodeRabbit + Codex)
Three precision/robustness fixes to the pooled view-in-a-field pass, each flagged
by review (the first two by BOTH CodeRabbit and Codex):
1. FP: the view-field alias map keyed the LHS with FieldName, so `other._view =
_owner.Memory` recorded THIS instance's `_view` as aliasing `_owner` — a later
handler read of this object's `_view.Span` would then falsely fire. Use
ThisFieldName for the LHS, matching the release/read paths (this/bare only).
2. Recall: an owner field written `System.Buffers.IMemoryOwner<byte>` (or an alias,
or a concrete type implementing IMemoryOwner) was missed by the
`StartsWith("IMemoryOwner")` string check, so releasedAt stayed empty and the
case was skipped. New `IsMemoryOwnerType` resolves the field's type SYMBOL
(interface or via AllInterfaces); the cheap StartsWith still short-circuits the
common unqualified spelling. IDisposable stays syntactic (unresolved customs).
3. Recall: `this._owner.Memory` was not recognised as a view (ViewOwner needs an
IdentifierNameSyntax receiver). New `FieldViewOwner` accepts a this/bare-field
receiver (ThisFieldName) for the `IMemoryOwner<T>.Memory` borrow, so both
`_owner.Memory` and `this._owner.Memory` alias, while `other._owner.Memory`
(another instance) does not.
Behaviour on the corpus is unchanged (the `_owner.Memory` view still aliases and
fires OWN002, the guarded after stays silent); the FP fix only narrows the map.
C# validated by CI.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent 243c439 commit fa09b1c
1 file changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1109 | 1109 | | |
1110 | 1110 | | |
1111 | 1111 | | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1112 | 1131 | | |
1113 | 1132 | | |
1114 | 1133 | | |
| |||
1991 | 2010 | | |
1992 | 2011 | | |
1993 | 2012 | | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
1994 | 2017 | | |
1995 | | - | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
1996 | 2021 | | |
1997 | 2022 | | |
1998 | 2023 | | |
| |||
2024 | 2049 | | |
2025 | 2050 | | |
2026 | 2051 | | |
2027 | | - | |
2028 | | - | |
| 2052 | + | |
| 2053 | + | |
2029 | 2054 | | |
2030 | 2055 | | |
2031 | 2056 | | |
| |||
0 commit comments