mirror of
https://github.com/apple/swift.git
synced 2026-10-22 19:15:50 +02:00
12 lines
483 B
Swift
12 lines
483 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@diagnose(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]
|
|
}
|
|
|
|
@diagnose(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]
|
|
}
|