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
// FIXME: We also ought to be diagnosing the macro argument
64
+
// Make sure we do MiscDiagnostics passes for both macro arguments and expansions.
65
+
65
66
_ = #identity(Int)
66
67
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-2]]{{.*}}identityfMf_.swift:1:1: error: expected member name or initializer call after type name
68
+
// CHECK-DIAG: Client.swift:[[@LINE-2]]:15: error: expected member name or initializer call after type name
67
69
68
70
_ ={
69
71
_ = #identity(Int)
70
72
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-2]]{{.*}}identityfMf0_.swift:1:1: error: expected member name or initializer call after type name
73
+
// CHECK-DIAG: Client.swift:[[@LINE-2]]:17: error: expected member name or initializer call after type name
71
74
}
72
75
73
76
_ = #identity(deprecatedFunc())
@@ -99,6 +102,14 @@ _ = #trailingClosure {
99
102
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-4]]{{.*}}trailingClosurefMf_.swift:2:27: warning: trailing closure in this context is confusable with the body of the statement
100
103
}
101
104
105
+
func testOptionalToAny(_ y:Int?){
106
+
_ = #trailingClosure {
107
+
let _:Any= y
108
+
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-3]]{{.*}}trailingClosurefMf_.swift:2:18: warning: expression implicitly coerced from 'Int?' to 'Any'
109
+
// CHECK-DIAG: Client.swift:[[@LINE-2]]:18: warning: expression implicitly coerced from 'Int?' to 'Any'
110
+
}
111
+
}
112
+
102
113
// rdar://138997009 - Make sure we don't crash in MiscDiagnostics' implicit
103
114
// self diagnosis.
104
115
structrdar138997009{
@@ -119,6 +130,7 @@ class rdar138997009_Class {
119
130
_ = #trailingClosure{
120
131
foo()
121
132
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-3]]{{.*}}trailingClosurefMf_.swift:2:9: error: call to method 'foo' in closure requires explicit use of 'self' to make capture semantics explicit
133
+
// CHECK-DIAG: Client.swift:[[@LINE-2]]:9: error: call to method 'foo' in closure requires explicit use of 'self' to make capture semantics explicit
0 commit comments