Repository navigation
Commit ac5746c
committed
feat(ir): carry source lines as a signed SourceLine across the verdict path
The representation the three RED commits were for. `own_ir::span::SourceLine`
is a `#[serde(transparent)]` newtype over `i64` and nothing else: no `valid()`,
no clamp, no normalisation, no `TryFrom`. `SourceLine(-1)` is legal. It is a
carrier, and every rule about which lines MEAN something stays exactly where it
already lives.
WHY signed 64: #326 made that range part of the OwnIR contract, and the
reference carries whatever the door accepted onto the verdict surface verbatim
— measured at i64::MIN, -1, 0, u32::MAX + 1 and i64::MAX, on the validated
`services[].line` path. A narrower carrier refuses verdicts the door admits.
The producer boundary stays visible rather than being flattened:
lexer token.line: u32 --From (lossless)--> AST line: SourceLine
OwnIR / lowered: i64 --exact--> AST line: SourceLine
The parser keeps its honest domain — a `.own` file has no line -2^63 — and
`ParseError.line` stays `u32` for the same reason. What changes is that the
shared AST stops asserting that every producer of a coordinate must be a lexer.
`From`, never `TryFrom`: every `u32` is a `SourceLine` and the conversion
cannot fail.
Widened along the whole semantic/verdict path: AST, own-cfg (`ir`, `builder`,
`buffers`, `Diag`), own-analysis (`di::Service`, effect, ownership, lifetime),
and own-diagnostics (`Diagnostic`, `Evidence`, `DiagKey`, `EvidenceIdentity`,
`DiagIdentity`, `LocatedDiagnostic::line`, `sarif::Step`, `sarif::Region`).
Two crates take an already-allowed DAG edge to own-ir for the first time
(own-syntax, own-diagnostics); the allowlist is unchanged.
NOT changed, deliberately:
* Both `>= 1` predicates. The DI004/DI005 site sentinel and the SARIF region
gate are preserved verbatim — they were always written `>= 1` and that keeps
meaning the same over a signed value, so a negative site now correctly takes
the registration fallback and a negative line still emits no region. They
were only ever *equivalent* to `!= 0` because u32 cannot go below zero.
* `column`. Still `Option<NonZeroU32>`: unlike a line it really does carry a
1-based contract, and dragging it along because both are "coordinates" is
the axis conflation cp1 spent three censuses removing.
* RID/SymId. Those are `u32` and stay `u32`. One of them — `leak_check`'s
`exclude` — was widened by the first mechanical pass and reverted: it is
compared against a RID, not a line, and only ever LOOKED like a coordinate
because both were u32. That is precisely the substitution this change exists
to stop, caught inside the change itself.
One legitimate narrowing remains and is now commented as such: `render_pretty`
converts to `usize` to index the source text, where a line with no
corresponding text has nothing to render and the chain already degrades to "".
That is a renderer fallback, not a verdict rule.
Also fixed a silent clamp found on the way: `fact_parity`'s `u32_of` mapped
anything past u32::MAX to 0 while reading frozen facts — harmless while no
fixture carried such a value, and a silent zero the moment one did. Replaced by
a `line_of` that reads the full signed range.
Evidence: every frozen parity surface still passes unchanged — cfg_parity, the
diagnostic ledger, sarif_replay, di_eff_fact_parity, the lowered replay and the
summaries goldens — so the widening is byte-compatible on all existing data.
Workspace: 0 test failures, clippy 0, cargo doc 0, Python suite green.
NOT yet proven, and not claimed: the four acceptance groups this change was
specified with — carrier preservation across the band on the Rust side,
sentinel preservation, projection preservation, and the identity re-proof for
DiagKey/EvidenceIdentity/DiagIdentity — plus their mutation controls. Existing
fixtures only exercise small positive lines, so they cannot distinguish this
from a build that still narrows. That is the next commit, and until it lands
this is a compiling representation rather than a demonstrated one.
Refs #250, #259.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CJF7MBi1ijU5m9cJVWgQsM1 parent 48e639d commit ac5746c
28 files changed
Lines changed: 328 additions & 196 deletions
File tree
- rust
- crates
- own-analysis
- src
- tests
- own-cfg
- src
- tests
- own-diagnostics
- src
- tests
- own-ir/src
- own-syntax
- src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | | - | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
133 | | - | |
134 | | - | |
| 135 | + | |
| 136 | + | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
141 | | - | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
401 | 403 | | |
402 | 404 | | |
403 | 405 | | |
404 | | - | |
405 | | - | |
| 406 | + | |
| 407 | + | |
406 | 408 | | |
407 | 409 | | |
408 | 410 | | |
| |||
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
| 448 | + | |
446 | 449 | | |
447 | 450 | | |
448 | | - | |
| 451 | + | |
449 | 452 | | |
450 | 453 | | |
451 | 454 | | |
| |||
492 | 495 | | |
493 | 496 | | |
494 | 497 | | |
495 | | - | |
| 498 | + | |
496 | 499 | | |
497 | 500 | | |
498 | 501 | | |
| |||
512 | 515 | | |
513 | 516 | | |
514 | 517 | | |
515 | | - | |
| 518 | + | |
516 | 519 | | |
517 | 520 | | |
518 | 521 | | |
| |||
524 | 527 | | |
525 | 528 | | |
526 | 529 | | |
527 | | - | |
| 530 | + | |
528 | 531 | | |
529 | 532 | | |
530 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
226 | | - | |
| 228 | + | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| |||
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
| 258 | + | |
256 | 259 | | |
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
260 | 263 | | |
261 | 264 | | |
262 | | - | |
| 265 | + | |
263 | 266 | | |
264 | 267 | | |
265 | 268 | | |
| |||
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
273 | | - | |
| 276 | + | |
274 | 277 | | |
275 | 278 | | |
276 | 279 | | |
| |||
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
283 | | - | |
| 286 | + | |
284 | 287 | | |
285 | 288 | | |
286 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | | - | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| 166 | + | |
164 | 167 | | |
165 | | - | |
| 168 | + | |
166 | 169 | | |
167 | | - | |
| 170 | + | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
| |||
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
186 | | - | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| |||
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
207 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
| |||
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
220 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
221 | 230 | | |
222 | 231 | | |
223 | 232 | | |
| |||
230 | 239 | | |
231 | 240 | | |
232 | 241 | | |
233 | | - | |
| 242 | + | |
234 | 243 | | |
235 | 244 | | |
0 commit comments