mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Swift 3 allowed a class to explicitly conform to AnyObject, although it was meaningless. Recent AnyObject-related changes started rejecting such conformances as ill-formed; allow them with a warning + Fix-It in Swift 3 compatibility mode.
11 lines
446 B
Swift
11 lines
446 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 3
|
|
|
|
protocol P { }
|
|
protocol Q { }
|
|
|
|
class Foo: AnyObject { } // expected-warning{{conformance of class 'Foo' to 'AnyObject' is redundant}}{{10-21=}}
|
|
|
|
class Bar: AnyObject, P { } // expected-warning{{conformance of class 'Bar' to 'AnyObject' is redundant}}{{12-23=}}
|
|
|
|
class Wibble: Bar, AnyObject, Q { } // expected-warning{{conformance of class 'Wibble' to 'AnyObject' is redundant}}{{18-29=}}
|