mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* spelling: adjacent Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: ambiguous Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: captures Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: effectful Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: nonoverride Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: ouroboros Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: overridden Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: qualified Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: received Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: refinement Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
33 lines
942 B
Swift
33 lines
942 B
Swift
// RUN: %target-typecheck-verify-swift -warn-implicit-overrides
|
|
|
|
// Test the warnings about implicit 'override' of protocol members.
|
|
|
|
|
|
protocol P0 {
|
|
associatedtype A // expected-note{{'A' declared here}}
|
|
|
|
func foo() // expected-note{{overridden declaration is here}}
|
|
|
|
var prop: A { get } // expected-note{{overridden declaration is here}}
|
|
}
|
|
|
|
protocol P1: P0 {
|
|
associatedtype A // expected-warning{{redeclaration of associated type 'A' from protocol 'P0' is better expressed as a 'where' clause on the protocol}}
|
|
|
|
func foo() // expected-warning{{implicit override should be marked with 'override' or suppressed with '@_nonoverride'}}
|
|
|
|
var prop: A { get } // expected-warning{{implicit override should be marked with 'override' or suppressed with '@_nonoverride'}}
|
|
}
|
|
|
|
// Silence warnings with @_nonoverride.
|
|
protocol P2: P0 {
|
|
@_nonoverride
|
|
associatedtype A
|
|
|
|
@_nonoverride
|
|
func foo()
|
|
|
|
@_nonoverride
|
|
var prop: A { get }
|
|
}
|