A SwiftUI body is a computed property, a protocol requirement has no
body, and a closure or local function belongs to the form around it.
The first picker kept every function, including the nested ones, and
missed the body, the protocol default, and a file-level closure.
Proved: test_swift_keeps_methods_bodies_and_top_level_closures_only
failed by reporting the nested function at lines 7-9. The SwiftUI pair
and the top-level closure pair were empty. All three pass, including a
Text versus Label view that scores below 1.0. The full suite passed,
90 tests, and dryer reports no duplication at 0.8.
Co-authored-by: Robert C. Martin <[email protected]>
Call names were kept, and everything else in a Swift expression was
still a generic word. filter matched select, >= matched !=, an
argument label disappeared, and a string did not match a number.
A navigation_expression is an attribute, so the called member stays
and the field name does not. A custom operator and an argument label
keep their spelling. Swift strings, nil, and real numbers are
literals, an interpolation is not, and a block comment is skipped.
Proved: the Swift tests for methods, operators, labels, literals,
comments, and tuple indexes pass, and the other languages still pass.
92 tests.
Co-authored-by: Robert C. Martin <[email protected]>
Renamed locals already matched, and so did filter versus select,
because a Swift call keeps its name in a call_suffix and the name
is a simple_identifier. Both were treated as ordinary words, so the
callee disappeared and the score stayed 1.0.
simple_identifier is a name, and call_suffix is the argument list, the
same two decisions the other languages already make.
Proved: test_a_different_swift_callee_is_not_the_same_structure failed
on a score of 1.0, then passed with the pair below 1.0. The renamed-local
pair still scores 1.0. The full suite passed, 82 tests.
Co-authored-by: Robert C. Martin <[email protected]>
A .swift file was not a source file, so a scan reported no candidates.
.swift now selects the swift grammar, and a function with a body is a
candidate form.
Proved: test_renamed_locals_in_swift_functions_match failed with an empty
report, then passed with one swift pair at score 1.0. The full suite
passed, 81 tests.
Co-authored-by: Robert C. Martin <[email protected]>