Compare a deinit the way other Swift methods are compared.

A deinit has a body, and a function nested inside it was being reported
on its own. The deinit is now the candidate, and the nested function
stays inside it. Actor methods are documented with the other type methods.

Proved by test_a_deinit_is_compared_and_keeps_its_nested_function.

Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
Cursor Agent
2026-11-25 23:51:01 +00:00
co-authored by Robert C. Martin
parent 105ff6f50c
commit 2862b8428e
4 changed files with 39 additions and 6 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ DUPLICATE score=0.89
| Python | functions and methods | functions nested inside another function |
| Swift | functions and methods with a body, computed properties, and file-level closures | initializers, subscripts, protocol requirements, and closures or functions nested inside another form |
A Swift computed property includes a SwiftUI `body`. A method on a struct, class, enum, or extension is a candidate, and so is a protocol method that has a default body. A protocol requirement does not. A closure written inside a function stays in that function. A closure bound with `let` or `var` at file scope is its own candidate, as a top-level arrow function is in TypeScript. Argument labels stay, including the label of a trailing closure, because in Swift they are part of the call. `>=`, `!=`, `...`, and `..<` stay. Locals, field names, and literals, including `nil`, do not. An interpolated string keeps the interpolation.
A Swift computed property includes a SwiftUI `body`. A method on a struct, class, actor, enum, or extension is a candidate, and so is a deinit and a protocol method that has a default body. A protocol requirement does not. A closure written inside a function stays in that function. A closure bound with `let` or `var` at file scope is its own candidate, as a top-level arrow function is in TypeScript. Argument labels stay, including the label of a trailing closure, because in Swift they are part of the call. `>=`, `!=`, `...`, and `..<` stay. Locals, field names, and literals, including `nil`, do not. An interpolated string keeps the interpolation.
Clojure reader conditionals keep the `:clj` branch, as dry4clj does. Syntax-quote is kept as a `syntax-quote` form rather than expanded.