Commit ce94c42
[test] SWIFT_NPE: pin out-of-scope shapes stay silent
Summary:
Adds corpus fixtures pinning that three Swift shapes which look superficially
like force-unwraps do NOT fire `SWIFT_NPE`, guarding against accidental
over-reporting as the checker evolves:
- `tryForceUnwrap_noSwiftNPE` — `try!` of a throwing call is an unhandled-error
force-try, not a nil dereference. It lowers to `swift_unexpectedError` on the
`error != nil` branch, a different shape from the Optional force-unwrap trap
(`__sil_assert_fail` on `eq(disc, 0)`). The recogniser correctly leaves it
alone, so it must stay out of `SWIFT_NPE` scope.
- `optionalMap_good` / `optionalFlatMap_good` — `.map` / `.flatMap` propagate the
Optional without force-unwrapping, so they can never trap.
All three produce no report (the test baseline is unchanged), documenting the
intended silence.
Reviewed By: davidpichardie
Differential Revision: D107524914
fbshipit-source-id: 4c545d5e2d74d84c69f079b707445aa179b67b411 parent 85fb0bd commit ce94c42
1 file changed
Lines changed: 29 additions & 0 deletions
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
0 commit comments