Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1// RUN: %target-typecheck-verify-swift -disable-experimental-parser-round-trip
2
3// https://github.com/swiftlang/swift/issues/85942
4// Verify that we do not crash when a KeyPath is used in a map with missing arguments.
5
6func f(buttonsStr: [Substring]) {
7 // expected-error@+2 {{key path cannot refer to instance method 'compactMap'}}
8 // expected-error@+1 {{cannot convert value of type '() -> Int' to expected argument type '(ArraySlice<Character>) throws -> Int?'}}
9 let _: [[Int]] = buttonsStr.map(\.split(separator: ",").compactMap(Int.init))
10}
11

After

1// RUN: %target-typecheck-verify-swift -disable-experimental-parser-round-trip
2
3// https://github.com/swiftlang/swift/issues/85942
4// Verify that we do not crash when a KeyPath is used in a map with missing arguments.
5
6func f(buttonsStr: [Substring]) {
7 // expected-error@+2 {{key path cannot refer to instance method 'compactMap'}}
8 // expected-error@+1 {{cannot convert value of type '() -> Int' to expected argument type '(ArraySlice<Character>) -> Int?'}}
9 let _: [[Int]] = buttonsStr.map(\.split(separator: ",").compactMap(Int.init))
10}
11

Before

source_file
comment "// RUN: %target-typecheck-verify-swift -disable-experimental"...
comment "// https://github.com/swiftlang/swift/issues/85942"
comment "// Verify that we do not crash when a KeyPath is used in a m"...
function_declaration
func "func"
simple_identifier "f"
( "("
parameter
simple_identifier "buttonsStr"
: ":"
array_type
[ "["
user_type
type_identifier "Substring"
] "]"
) ")"
function_body
{ "{"
comment "// expected-error@+2 {{key path cannot refer to instance met"...
comment "// expected-error@+1 {{cannot convert value of type '() -> I"...
statements (+62 nodes collapsed)
} "}"

After

source_file
comment "// RUN: %target-typecheck-verify-swift -disable-experimental"...
comment "// https://github.com/swiftlang/swift/issues/85942"
comment "// Verify that we do not crash when a KeyPath is used in a m"...
function_declaration
func "func"
simple_identifier "f"
( "("
parameter
simple_identifier "buttonsStr"
: ":"
array_type
[ "["
user_type
type_identifier "Substring"
] "]"
) ")"
function_body
{ "{"
comment "// expected-error@+2 {{key path cannot refer to instance met"...
comment "// expected-error@+1 {{cannot convert value of type '() -> I"...
statements (+62 nodes collapsed)
} "}"