mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This should have been done for Swift 4.2 according to SE-0204, but better later than never. Deprecating these methods as of Swift 5.0. Also modfying the tests to check for the deprecation message. Fixes: <rdar://problem/43694210>
9 lines
472 B
Swift
9 lines
472 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
|
|
let a = [10, 20, 30, 40, 50, 60]
|
|
|
|
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)'}} expected-note {{use 'firstIndex(of:)' instead}}
|
|
_ = a.firstIndex(of: 30)
|
|
_ = a.index(where: { $0 > 30 }) // expected-warning {{'index(where:)' is deprecated: renamed to 'firstIndex(where:)'}} expected-note {{use 'firstIndex(where:)' instead}}
|
|
_ = a.firstIndex(where: { $0 > 30 })
|