Skip to content

Commit d9294e8

Browse files
[tests] Adjusting key path missing component contextual tests
1 parent c77fe12 commit d9294e8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/expr/unary/keypath/keypath.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct A: Hashable {
3636
func hash(into hasher: inout Hasher) { fatalError() }
3737
}
3838
struct B {}
39-
struct C<T> { // expected-note 3 {{'T' declared as parameter to type 'C'}}
39+
struct C<T> { // expected-note 4 {{'T' declared as parameter to type 'C'}}
4040
var value: T
4141
subscript() -> T { get { return value } }
4242
subscript(sub: Sub) -> T { get { return value } set { } }
@@ -224,15 +224,17 @@ func testKeyPathInGenericContext<H: Hashable, X>(hashable: H, anything: X) {
224224
}
225225

226226
func testDisembodiedStringInterpolation(x: Int) {
227-
\(x) // expected-error{{string interpolation}} expected-error{{}}
228-
\(x, radix: 16) // expected-error{{string interpolation}} expected-error{{}}
227+
\(x) // expected-error{{string interpolation can only appear inside a string literal}}
228+
\(x, radix: 16) // expected-error{{string interpolation can only appear inside a string literal}}
229229
}
230230

231231
func testNoComponents() {
232232
let _: KeyPath<A, A> = \A // expected-error{{must have at least one component}}
233-
let _: KeyPath<C, A> = \C // expected-error{{must have at least one component}} expected-error{{}}
233+
let _: KeyPath<C, A> = \C // expected-error{{must have at least one component}}
234234
// expected-error@-1 {{generic parameter 'T' could not be inferred}}
235-
// expected-error@-2 {{cannot convert value of type 'KeyPath<Root, Value>' to specified type 'KeyPath<C<T>, A>'}}
235+
let _: KeyPath<A, C> = \A // expected-error{{must have at least one component}}
236+
// expected-error@-1 {{generic parameter 'T' could not be inferred}}
237+
_ = \A // expected-error {{key path must have at least one component}}
236238
}
237239

238240
struct TupleStruct {

0 commit comments

Comments
 (0)