You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let _:KeyPath<String?,Int?>= \.utf8.count // expected-error {{no exact matches in reference to property 'count'}}
1059
+
// expected-note@-1 {{found candidate with type 'Int'}}
1060
+
}
1061
+
1062
+
// rdar://74711236 - crash due to incorrect member access in key path
1063
+
func rdar74711236(){
1064
+
structS{
1065
+
vararr:[V]=[]
1066
+
}
1067
+
1068
+
structV:Equatable{
1069
+
}
1070
+
1071
+
enumType{
1072
+
case store
1073
+
}
1074
+
1075
+
structContext{
1076
+
func supported()->[Type]{
1077
+
return[]
1078
+
}
1079
+
}
1080
+
1081
+
func test(context:Context?){
1082
+
vars=S()
1083
+
1084
+
s.arr ={
1085
+
// FIXME: Missing member reference is pattern needs a better diagnostic
1086
+
iflet type = context?.store { // expected-error {{type of expression is ambiguous without more context}}
1087
+
// `isSupported` should be an invalid declaration to trigger a crash in `map(\.option)`
1088
+
letisSupported= context!.supported().contains(type) // expected-error {{missing argument label 'where:' in call}} expected-error {{converting non-escaping value to '(Type) throws -> Bool' may allow it to escape}}
1089
+
return(isSupported ?[type]:[]).map(\.option)
1090
+
// expected-error@-1 {{value of type 'Any' has no member 'option'}}
1091
+
// expected-note@-2 {{cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members}}
0 commit comments