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}}
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}}
54
55
let _:@convention(c)(_)->_={(x:Double)in0}
55
56
let _:@convention(c)(_)->Int={(x:Double)in0}
56
57
@@ -98,18 +99,18 @@ extension Bar {
98
99
}
99
100
100
101
// FIXME: We should probably have better diagnostics for these situations--the user probably meant to use implicit member syntax
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}}
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}}
105
106
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}}
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}}
110
111
111
112
let _:Int.Type= _ // expected-error {{'_' can only appear in a pattern or on the left side of an assignment}}
112
-
let _:Int.Type= _.self
113
+
let _:Int.Type= _.self // expected-error {{placeholders are not allowed as top-level types}}
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self)
195
+
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self) // expected-error {{placeholders are not allowed as top-level types}}
195
196
let _:SetFailureType<Int,[String]>=Just<Int>().setFailureType(to:[_].self)
196
197
let _:SetFailureType<Int,(String)->Double>=Just<Int>().setFailureType(to:((_)-> _).self)
197
198
let _:SetFailureType<Int,(String,Double)>=Just<Int>().setFailureType(to:(_, _).self)
198
199
199
200
// TODO: Better error message here? Would be nice if we could point to the placeholder...
200
-
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self).setFailureType(to:String.self) // expected-error {{generic parameter 'T' could not be inferred}}
201
+
let _:SetFailureType<Int,String>=Just<Int>().setFailureType(to: _.self).setFailureType(to:String.self) // expected-error {{placeholders are not allowed as top-level types}}
202
+
203
+
let _:(_)=0asInt // expected-error {{placeholders are not allowed as top-level types}}
204
+
let _:Int=0as(_) // expected-error {{placeholders are not allowed as top-level types}}
0 commit comments