Files
swift-mirror/test/stdlib/IndexDistanceRemoval.swift
Doug Gregor b182c96bd7 Print diagnostic group names by default
Print diagnostic groups as part of the LLVM printer in the same manner as the
Swift one does, always. Make `-print-diagnostic-groups` an inert option, since we
always print diagnostic group names with the `[#GroupName]` syntax.

As part of this, we no longer render the diagnostic group name as part
of the diagnostic *text*, instead leaving it up to the diagnostic
renderer to handle the category appropriately. Update all of the tests
that were depending on `-print-diagnostic-groups` putting it into the
text to instead use the `{{documentation-file=<file name>}}`
diagnostic verification syntax.
2025-03-29 15:40:56 -07:00

23 lines
892 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 4
struct Int64Distance<Element>: Collection {
let _storage: [Element]
typealias Index = Int64
typealias IndexDistance = Int64
var startIndex: Index { return Int64(_storage.startIndex) }
var endIndex: Index { return Int64(_storage.startIndex) }
func index(after i: Index) -> Index { return i + 1 }
subscript(i: Index) -> Element { return _storage[Int(i)] }
}
let c = Int64Distance(_storage: [1,2,3])
let i64: Int64 = 2
_ = c.index(c.startIndex, offsetBy: i64) // expected-warning {{'index(_:offsetBy:)' is deprecated: all index distances are now of type Int}}{{documentation-file=deprecated-declaration}}
let _: Int64 = c.distance(from: c.startIndex, to: c.endIndex) // expected-warning {{distance(from:to:)' is deprecated: all index distances are now of type Int}}{{documentation-file=deprecated-declaration}}