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
[QoI] make several improvements to the unused expression diagnostics,… (#2559)
* [QoI] make several improvements to the unused expression diagnostics, to go
along with recent policy changes:
- For expression types that are not specifically handled, make sure to
produce a general "unused value" warning, catching a bunch of unused
values in the testsuite.
- For unused operator results, diagnose them as uses of the operator
instead of "calls".
- For calls, mutter the type of the result for greater specificity.
- For initializers, mutter the type of the initialized value.
- Look through OpenExistentialExpr's so we can handle protocol member
references propertly.
- Look through several other expressions so we handle @discardableResult
better.
* Fix validation-test/Sema/OverridesAndOverloads.swift after compiler started produced more warnings
x.`class`() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}} expected-warning {{result of call to 'class()' is unused}}
37
-
NSObject.`class`() // expected-error {{'class()' is unavailable in Swift: use 'self' instead}} expected-warning {{result of call to 'class()' is unused}}
38
-
obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}}
38
+
_ =NSObject.`class`() // expected-error {{'class()' is unavailable in Swift: use 'self' instead}}
39
+
_ =obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}}
letca= NSConnectionDidDieNotification // expected-error {{'NSConnectionDidDieNotification' is unavailable in Swift: Use NSXPCConnection instead}}
102
103
letcc= NSConnectionReplyMode // expected-error {{'NSConnectionReplyMode' is unavailable in Swift: Use NSXPCConnection instead}}
103
-
o.classForPortCoder // expected-error {{'classForPortCoder' is unavailable in Swift: Use NSXPCConnection instead}}
104
+
_ =o.classForPortCoder // expected-error {{'classForPortCoder' is unavailable in Swift: Use NSXPCConnection instead}}
104
105
}
105
106
106
107
func test_NSCalendarDate(_ o:NSCalendarDate){} // expected-error {{'NSCalendarDate' is unavailable in Swift: Use NSCalendar and NSDateComponents and NSDateFormatter instead}}
0 commit comments