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 _:[String:Int]=dictionary(ofType: _.self) // expected-error {{placeholders are not allowed as top-level types}}
51
+
let _:[String:Int]=dictionary(ofType: _.self)
52
52
53
53
let _:@convention(c)_={0} // expected-error {{@convention attribute only applies to function types}}
54
-
// expected-error@-1 {{placeholders are not allowed as top-level types}}
55
54
let _:@convention(c)(_)->_={(x:Double)in0}
56
55
let _:@convention(c)(_)->Int={(x:Double)in0}
57
56
@@ -99,18 +98,18 @@ extension Bar {
99
98
}
100
99
101
100
// FIXME: We should probably have better diagnostics for these situations--the user probably meant to use implicit member syntax
102
-
let _:Int=_() // expected-error {{placeholders are not allowed as top-level types}}
103
-
let _:()->Int={_()} // expected-error {{unable to infer closure type in the current context}} expected-error {{placeholders are not allowed as top-level types}}
104
-
let _:Int= _.init() // expected-error {{placeholders are not allowed as top-level types}}
105
-
let _:()->Int={ _.init()} // expected-error {{unable to infer closure type in the current context}} expected-error {{placeholders are not allowed as top-level types}}
101
+
let _:Int=_() // expected-error {{type of expression is ambiguous without more context}}
102
+
let _:()->Int={_()} // expected-error {{unable to infer closure type in the current context}}
103
+
let _:Int= _.init() // expected-error {{could not infer type for placeholder}}
104
+
let _:()->Int={ _.init()} // expected-error {{could not infer type for placeholder}}
106
105
107
-
func returnsInt()->Int{_()} // expected-error {{placeholders are not allowed as top-level types}}
108
-
func returnsIntClosure()->()->Int{{_()}} // expected-error {{unable to infer closure type in the current context}} expected-error {{placeholders are not allowed as top-level types}}
109
-
func returnsInt2()->Int{ _.init()} // expected-error {{placeholders are not allowed as top-level types}}
110
-
func returnsIntClosure2()->()->Int{{ _.init()}} // expected-error {{unable to infer closure type in the current context}} expected-error {{placeholders are not allowed as top-level types}}
106
+
func returnsInt()->Int{_()} // expected-error {{type of expression is ambiguous without more context}}
107
+
func returnsIntClosure()->()->Int{{_()}} // expected-error {{unable to infer closure type in the current context}}
108
+
func returnsInt2()->Int{ _.init()} // expected-error {{could not infer type for placeholder}}
109
+
func returnsIntClosure2()->()->Int{{ _.init()}} // expected-error {{could not infer type for placeholder}}
111
110
112
111
let _:Int.Type= _ // expected-error {{'_' can only appear in a pattern or on the left side of an assignment}}
113
-
let _:Int.Type= _.self // expected-error {{placeholders are not allowed as top-level types}}
func setFailureType<T>(to:T.Type)->SetFailureType<Output,T>{ // expected-note {{in call to function 'setFailureType(to:)'}}
191
190
return.init()
192
191
}
193
192
}
194
193
195
-
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self) // expected-error {{placeholders are not allowed as top-level types}}
194
+
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self)
196
195
let _:SetFailureType<Int,[String]>=Just<Int>().setFailureType(to:[_].self)
197
196
let _:SetFailureType<Int,(String)->Double>=Just<Int>().setFailureType(to:((_)-> _).self)
198
197
let _:SetFailureType<Int,(String,Double)>=Just<Int>().setFailureType(to:(_, _).self)
@@ -216,3 +215,5 @@ _ = (1...10)
216
215
.map{(intValue, x:(_, boolValue: _)) in
217
216
x.boolValue ? intValue :0
218
217
}
218
+
219
+
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self).setFailureType(to:String.self) // expected-error {{generic parameter 'T' could not be inferred}}
0 commit comments