mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
Unified across module-wide configuration flags (`-Wwarning`, `-Werror`, etc.) and syntactic configuration attribute `@warn`.
13 lines
573 B
Swift
13 lines
573 B
Swift
// REQUIRES: swift_feature_SourceWarningControl
|
|
// RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl
|
|
|
|
@warn(PerformanceHints, as: error)
|
|
func foo() -> [Int] { // expected-error {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}}
|
|
return [1,2,3]
|
|
}
|
|
|
|
@warn(ReturnTypeImplicitCopy, as: warning)
|
|
func bar() -> [Int] { // expected-warning {{Performance: 'bar()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}}
|
|
return [1,2,3]
|
|
}
|