diff --git a/src/dryer/astnorm.py b/src/dryer/astnorm.py index 88f7582..b86d8c6 100644 --- a/src/dryer/astnorm.py +++ b/src/dryer/astnorm.py @@ -28,6 +28,7 @@ _IDENTIFIERS = { "shorthand_property_identifier", "shorthand_property_identifier_pattern", "package_identifier", + "simple_identifier", } _LITERALS = { @@ -134,7 +135,7 @@ _SCOPED = { "scoped_type_identifier", } -_ARG_LISTS = {"argument_list", "arguments"} +_ARG_LISTS = {"argument_list", "arguments", "call_suffix"} _TYPE_ARGS = {"type_arguments", "type_parameters"} _DATA: bytes = b"" diff --git a/tests/test_swift.py b/tests/test_swift.py index ceed466..51f006c 100644 --- a/tests/test_swift.py +++ b/tests/test_swift.py @@ -38,3 +38,23 @@ def test_renamed_locals_in_swift_functions_match(tmp_path): assert [(item.language, item.left.file, item.right.file, item.score) for item in found] == [ ("swift", "left.swift", "right.swift", 1.0) ] + + +def test_a_different_swift_callee_is_not_the_same_structure(tmp_path): + write_source(tmp_path, "left.swift", SWIFT_LEFT) + write_source( + tmp_path, + "right.swift", + """\ +func beta(items: [Int]) -> [Int] { + let kept = select(items, even) + return collect(kept, dec) +} +""", + ) + files = sorted(tmp_path.glob("*.swift")) + entries, warnings = scan_files(files, tmp_path, min_lines=1, min_nodes=1) + assert warnings == [] + found = find_duplicates(entries, threshold=0.0) + assert len(found) == 1 + assert found[0].score < 1.0