Repository navigation
Commit 5a3ba52
committed
fix(extractor): key the field-alias map by local SYMBOL, count ref/out rebinds (Codex P2 + CodeRabbit)
The first cut keyed the alias map by identifier STRING, scanned class-wide, and
gated reassignment only on `=` expressions. Three holes, all flagged in review:
- CodeRabbit (major) + Codex #2 — class-wide name keys conflate same-named locals
across methods: an unrelated `c.Dispose()` in one method could credit a field
aliased by a `c` in another (FN), and two aliases reusing a name overwrite each
other. Now keyed by the LOCAL SYMBOL (model.GetDeclaredSymbol(decl)), and the
dispose scan resolves the receiver symbol — so each alias is scope-exact.
- Codex #1 — an alias rebound through a `ref`/`out` argument (`Swap(ref a)`) was
not counted as reassigned, so a disposed-after-rebind alias wrongly credited the
field (FN). The reassignment set now includes ref/out argument locals.
- Iterating declarators by symbol (is ILocalSymbol) also drops non-local
declarators from the map (locals-only, as intended).
Direct field disposals are unchanged: a receiver that is not an alias local falls
back to FieldName, exactly as before.
Regression controls added: RefReboundAliasLeaks (`Swap(ref a)` then dispose ->
_refRebound still leaks) and ScopedAliasNameLeak (an unrelated same-named `c`
disposed in another method must not credit _scopedLeak -> it still leaks). CI
asserts both, alongside the existing aliased-silent and never-disposed/`=`-rebound
controls.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent c678ab6 commit 5a3ba52
3 files changed
Lines changed: 74 additions & 17 deletions
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
256 | 263 | | |
257 | 264 | | |
258 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | | - | |
2205 | | - | |
2206 | | - | |
2207 | | - | |
2208 | | - | |
2209 | | - | |
2210 | | - | |
2211 | | - | |
2212 | | - | |
2213 | | - | |
2214 | | - | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
2215 | 2222 | | |
2216 | 2223 | | |
2217 | 2224 | | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
2221 | 2231 | | |
2222 | 2232 | | |
2223 | 2233 | | |
2224 | 2234 | | |
2225 | | - | |
| 2235 | + | |
| 2236 | + | |
2226 | 2237 | | |
2227 | 2238 | | |
2228 | 2239 | | |
2229 | 2240 | | |
2230 | 2241 | | |
2231 | | - | |
| 2242 | + | |
2232 | 2243 | | |
2233 | 2244 | | |
2234 | 2245 | | |
2235 | 2246 | | |
2236 | | - | |
| 2247 | + | |
| 2248 | + | |
2237 | 2249 | | |
2238 | 2250 | | |
2239 | 2251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
0 commit comments