Requires an N:M mapping (2:1)

This mapping is unfinished: 3 of 1806 nodes are still unmarked.

This mapping has 3 multi-map groups: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

Before

…lines 1–81 unchanged (81 lines)
82
83// MARK: - NSError tests
84
85extension ExitCodeTests {
86 func testNSErrorIsHandled() {
87 struct NSErrorCommand: ParsableCommand {
88 static let fileNotFoundNSError = NSError(
89 domain: "", code: 1,
90 userInfo: [
91 NSLocalizedDescriptionKey:
92 "The file “foo/bar” couldn’t be opened because there is no such file"
93 ])
94 }
95 XCTAssertEqual(
96 NSErrorCommand.exitCode(for: NSErrorCommand.fileNotFoundNSError),
97 ExitCode(rawValue: 1))
98 XCTAssertEqual(
99 NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
100 "The file “foo/bar” couldn’t be opened because there is no such file")
101 }
102}
103

After

…lines 1–81 unchanged (81 lines)
82
83// MARK: - NSError tests
84
85extension ExitCodeTests {
86 func testNSErrorIsHandled() {
87 struct NSErrorCommand: ParsableCommand {
88 static let message =
89 "The file “foo/bar” couldn’t be opened because there is no such file"
90
91 static let fileNotFoundNSError = NSError(
92 domain: "TestError",
93 code: 1,
94 userInfo: [NSLocalizedDescriptionKey: Self.message])
95 }
96 XCTAssertEqual(
97 NSErrorCommand.exitCode(for: NSErrorCommand.fileNotFoundNSError),
98 ExitCode(rawValue: 1))
99
100 #if canImport(FoundationEssentials)
101 let prefix = "Error Domain=TestError Code=1 \"(null)\""
102 #if compiler(<6.1)
103 XCTAssertEqual(
104 NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
105 "\(prefix)")
106 #else
107 XCTAssertEqual(
108 NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
109 "\(prefix)UserInfo={NSLocalizedDescription=\(NSErrorCommand.message)}"
110 )
111 #endif
112 #else
113 XCTAssertEqual(
114 NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
115 NSErrorCommand.message)
116 #endif
117 }
118}
119

Before

source_file
comment "//===-------------------------------------------------------"...
comment "//"
comment "// This source file is part of the Swift Argument Parser ope"...
comment "//"
comment "// Copyright (c) 2020 Apple Inc. and the Swift project autho"...
comment "// Licensed under Apache License v2.0 with Runtime Library E"...
comment "//"
comment "// See https://swift.org/LICENSE.txt for license information"
comment "//"
comment "//===-------------------------------------------------------"...
import_declaration
import "import"
identifier
simple_identifier "XCTest"
import_declaration
modifiers
attribute
@ "@"
user_type
type_identifier "testable"
import "import"
identifier
simple_identifier "ArgumentParser"
class_declaration
modifiers
inheritance_modifier
final "final"
class "class"
type_identifier "ExitCodeTests"
: ":"
inheritance_specifier
user_type
type_identifier "XCTestCase"
class_body
{ "{"
} "}"
comment "// MARK: -"
comment "// swift-format-ignore: AlwaysUseLowerCamelCase"
comment "// https://github.com/apple/swift-argument-parser/issues/710"
class_declaration (+657 nodes collapsed)
comment "// MARK: - NSError tests"
class_declaration
extension "extension"
user_type
type_identifier "ExitCodeTests"
class_body
{ "{"
function_declaration
func "func"
simple_identifier "testNSErrorIsHandled"
( "("
) ")"
function_body
{ "{"
statements
class_declaration
struct "struct"
type_identifier "NSErrorCommand"
: ":"
inheritance_specifier
user_type
type_identifier "ParsableCommand"
class_body
{ "{"
property_declaration
modifiers
property_modifier
static "static"
value_binding_pattern
let "let"
pattern
simple_identifier "fileNotFoundNSError"
= "="
call_expression
simple_identifier "NSError"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "domain"
: ":"
line_string_literal
" "\""
" "\""
, ","
value_argument
value_argument_label
simple_identifier "code"
: ":"
integer_literal "1"
, ","
value_argument
value_argument_label
simple_identifier "userInfo"
: ":"
dictionary_literal
[ "["
simple_identifier "NSLocalizedDescriptionKey"
: ":"
line_string_literal any 2:1
" "\"" any 2:1
line_str_text "The file “foo/bar” couldn’t be opened because there is no su"...
" "\"" any 2:1
] "]"
) ")"
} "}"
call_expression (+39 nodes collapsed)
call_expression
simple_identifier "XCTAssertEqual"
call_suffix
value_arguments
( "("
value_argument
call_expression
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "for"
: ":"
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "fileNotFoundNSError"
) ")"
, ","
value_argument
line_string_literal any 2:1
" "\"" any 2:1
line_str_text "The file “foo/bar” couldn’t be opened because there is no su"...
" "\"" any 2:1
) ")"
} "}"
} "}"

After

source_file
comment "//===-------------------------------------------------------"...
comment "//"
comment "// This source file is part of the Swift Argument Parser ope"...
comment "//"
comment "// Copyright (c) 2020 Apple Inc. and the Swift project autho"...
comment "// Licensed under Apache License v2.0 with Runtime Library E"...
comment "//"
comment "// See https://swift.org/LICENSE.txt for license information"
comment "//"
comment "//===-------------------------------------------------------"...
import_declaration
import "import"
identifier
simple_identifier "XCTest"
import_declaration
modifiers
attribute
@ "@"
user_type
type_identifier "testable"
import "import"
identifier
simple_identifier "ArgumentParser"
class_declaration
modifiers
inheritance_modifier
final "final"
class "class"
type_identifier "ExitCodeTests"
: ":"
inheritance_specifier
user_type
type_identifier "XCTestCase"
class_body
{ "{"
} "}"
comment "// MARK: -"
comment "// swift-format-ignore: AlwaysUseLowerCamelCase"
comment "// https://github.com/apple/swift-argument-parser/issues/710"
class_declaration (+657 nodes collapsed)
comment "// MARK: - NSError tests"
class_declaration
extension "extension"
user_type
type_identifier "ExitCodeTests"
class_body
{ "{"
function_declaration
func "func"
simple_identifier "testNSErrorIsHandled"
( "("
) ")"
function_body
{ "{"
statements
class_declaration
struct "struct"
type_identifier "NSErrorCommand"
: ":"
inheritance_specifier
user_type
type_identifier "ParsableCommand"
class_body
{ "{"
property_declaration
modifiers
property_modifier
static "static"
value_binding_pattern
let "let"
pattern
simple_identifier "message"
= "="
line_string_literal any 2:1
" "\"" any 2:1
line_str_text "The file “foo/bar” couldn’t be opened because there is no su"...
" "\"" any 2:1
property_declaration
modifiers
property_modifier
static "static"
value_binding_pattern
let "let"
pattern
simple_identifier "fileNotFoundNSError"
= "="
call_expression
simple_identifier "NSError"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "domain"
: ":"
line_string_literal
" "\""
line_str_text "TestError"
" "\""
, ","
value_argument
value_argument_label
simple_identifier "code"
: ":"
integer_literal "1"
, ","
value_argument
value_argument_label
simple_identifier "userInfo"
: ":"
dictionary_literal
[ "["
simple_identifier "NSLocalizedDescriptionKey"
: ":"
navigation_expression
simple_identifier "Self"
navigation_suffix
. "."
simple_identifier "message"
] "]"
) ")"
} "}"
call_expression (+39 nodes collapsed)
directive
#if "#if"
canImport "canImport"
( "("
simple_identifier "FoundationEssentials"
) ")"
property_declaration
value_binding_pattern
let "let"
pattern
simple_identifier "prefix"
= "="
line_string_literal
" "\""
line_str_text "Error Domain=TestError Code=1 "
str_escaped_char "\\\""
line_str_text "(null)"
str_escaped_char "\\\""
" "\""
directive
#if "#if"
compiler "compiler"
( "("
< "<"
integer_literal "6"
. "."
integer_literal "1"
) ")"
call_expression
simple_identifier "XCTAssertEqual"
call_suffix
value_arguments
( "("
value_argument
call_expression
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "for"
: ":"
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "fileNotFoundNSError"
) ")"
, ","
value_argument
line_string_literal
" "\""
\( "\\("
interpolated_expression
simple_identifier "prefix"
) ")"
" "\""
) ")"
directive
#else "#else"
call_expression
simple_identifier "XCTAssertEqual"
call_suffix
value_arguments
( "("
value_argument
call_expression
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "for"
: ":"
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "fileNotFoundNSError"
) ")"
, ","
value_argument
line_string_literal
" "\""
\( "\\("
interpolated_expression
simple_identifier "prefix"
) ")"
line_str_text "UserInfo={NSLocalizedDescription="
\( "\\("
interpolated_expression
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
) ")"
line_str_text "}"
" "\""
) ")"
directive
#endif "#endif"
directive
#else "#else"
call_expression
simple_identifier "XCTAssertEqual"
call_suffix
value_arguments
( "("
value_argument
call_expression
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "for"
: ":"
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "fileNotFoundNSError"
) ")"
, ","
value_argument
navigation_expression
simple_identifier "NSErrorCommand"
navigation_suffix
. "."
simple_identifier "message"
) ")"
directive
#endif "#endif"
} "}"
} "}"