Skip to content

Commit f7234a3

Browse files
[tests] Adjusting SR-12827 test cases
1 parent 50803b8 commit f7234a3

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3071,7 +3071,7 @@ class ConstraintSystem {
30713071
return typeVar->getImpl().getRepresentative(getSavedBindings());
30723072
}
30733073

3074-
/// Finds if the given type variable is representative for a type
3074+
/// Find if the given type variable is representative for a type
30753075
/// variable which last locator path element is of the specified kind.
30763076
/// If true returns the type variable which it is the representative for.
30773077
TypeVariableType *

test/expr/unary/keypath/keypath.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -906,16 +906,15 @@ func testKeyPathHole() {
906906
f(\.x) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}} {{6-6=<#Root#>}}
907907
f(\.x.y) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}} {{6-6=<#Root#>}}
908908

909-
// FIXME(SR-12827): Instead of "generic parameter 'T' could not be inferred",
910-
// we should offer the same diagnostic as above.
911-
func provideValueButNotRoot<T>(_ fn: (T) -> String) {} // expected-note 2{{in call to function 'provideValueButNotRoot'}}
912-
provideValueButNotRoot(\.x) // expected-error {{generic parameter 'T' could not be inferred}}
913-
provideValueButNotRoot(\.x.y) // expected-error {{generic parameter 'T' could not be inferred}}
909+
func provideValueButNotRoot<T>(_ fn: (T) -> String) {}
910+
provideValueButNotRoot(\.x) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}}
911+
provideValueButNotRoot(\.x.y) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}}
914912
provideValueButNotRoot(\String.foo) // expected-error {{value of type 'String' has no member 'foo'}}
915913

916-
func provideKPValueButNotRoot<T>(_ kp: KeyPath<T, String>) {} // expected-note 3{{in call to function 'provideKPValueButNotRoot'}}
917-
provideKPValueButNotRoot(\.x) // expected-error {{generic parameter 'T' could not be inferred}}
918-
provideKPValueButNotRoot(\.x.y) // expected-error {{generic parameter 'T' could not be inferred}}
914+
func provideKPValueButNotRoot<T>(_ kp: KeyPath<T, String>) {} // expected-note {{in call to function 'provideKPValueButNotRoot'}}
915+
provideKPValueButNotRoot(\.x) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}}
916+
provideKPValueButNotRoot(\.x.y) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}}
917+
919918
provideKPValueButNotRoot(\String.foo)
920919
// expected-error@-1 {{value of type 'String' has no member 'foo'}}
921920
// expected-error@-2 {{generic parameter 'T' could not be inferred}}

0 commit comments

Comments
 (0)