Skip to content

Commit edf53b2

Browse files
DougGregorairspeedswift
authored andcommitted
Consistently use Int for ExistentialCollection’s IndexDistance type.
1 parent 524461d commit edf53b2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -331,29 +331,29 @@ internal class _AnyRandomAccessCollectionBox<Element>
331331
@_versioned
332332
@_inlineable
333333
internal func _index(
334-
_ i: _AnyIndexBox, offsetBy n: Int64
334+
_ i: _AnyIndexBox, offsetBy n: Int
335335
) -> _AnyIndexBox {
336336
_abstract()
337337
}
338338

339339
@_versioned
340340
@_inlineable
341341
internal func _index(
342-
_ i: _AnyIndexBox, offsetBy n: Int64, limitedBy limit: _AnyIndexBox
342+
_ i: _AnyIndexBox, offsetBy n: Int, limitedBy limit: _AnyIndexBox
343343
) -> _AnyIndexBox? {
344344
_abstract()
345345
}
346346

347347
@_versioned
348348
@_inlineable
349-
internal func _formIndex(_ i: inout _AnyIndexBox, offsetBy n: Int64) {
349+
internal func _formIndex(_ i: inout _AnyIndexBox, offsetBy n: Int) {
350350
_abstract()
351351
}
352352

353353
@_versioned
354354
@_inlineable
355355
internal func _formIndex(
356-
_ i: inout _AnyIndexBox, offsetBy n: Int64, limitedBy limit: _AnyIndexBox
356+
_ i: inout _AnyIndexBox, offsetBy n: Int, limitedBy limit: _AnyIndexBox
357357
) -> Bool {
358358
_abstract()
359359
}
@@ -362,7 +362,7 @@ internal class _AnyRandomAccessCollectionBox<Element>
362362
@_inlineable
363363
internal func _distance(
364364
from start: _AnyIndexBox, to end: _AnyIndexBox
365-
) -> Int64 {
365+
) -> Int {
366366
_abstract()
367367
}
368368

@@ -381,7 +381,7 @@ internal class _AnyRandomAccessCollectionBox<Element>
381381

382382
@_inlineable // FIXME(sil-serialize-all)
383383
@_versioned
384-
internal var _count: Int64 { _abstract() }
384+
internal var _count: Int { _abstract() }
385385

386386
// TODO: swift-3-indexing-model: forward the following methods.
387387
/*
@@ -628,7 +628,7 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
628628
@_versioned
629629
@_inlineable
630630
internal override func _index(
631-
_ i: _AnyIndexBox, offsetBy n: Int64
631+
_ i: _AnyIndexBox, offsetBy n: Int
632632
) -> _AnyIndexBox {
633633
return _IndexBox(_base: _base.index(_unbox(i), offsetBy: numericCast(n)))
634634
}
@@ -637,7 +637,7 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
637637
@_inlineable
638638
internal override func _index(
639639
_ i: _AnyIndexBox,
640-
offsetBy n: Int64,
640+
offsetBy n: Int,
641641
limitedBy limit: _AnyIndexBox
642642
) -> _AnyIndexBox? {
643643
return _base.index(
@@ -650,7 +650,7 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
650650
@_versioned
651651
@_inlineable
652652
internal override func _formIndex(
653-
_ i: inout _AnyIndexBox, offsetBy n: Int64
653+
_ i: inout _AnyIndexBox, offsetBy n: Int
654654
) {
655655
if let box = i as? _IndexBox<S.Index> {
656656
return _base.formIndex(&box._base, offsetBy: numericCast(n))
@@ -661,7 +661,7 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
661661
@_versioned
662662
@_inlineable
663663
internal override func _formIndex(
664-
_ i: inout _AnyIndexBox, offsetBy n: Int64, limitedBy limit: _AnyIndexBox
664+
_ i: inout _AnyIndexBox, offsetBy n: Int, limitedBy limit: _AnyIndexBox
665665
) -> Bool {
666666
if let box = i as? _IndexBox<S.Index> {
667667
return _base.formIndex(
@@ -677,13 +677,13 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
677677
internal override func _distance(
678678
from start: _AnyIndexBox,
679679
to end: _AnyIndexBox
680-
) -> Int64 {
680+
) -> Int {
681681
return numericCast(_base.distance(from: _unbox(start), to: _unbox(end)))
682682
}
683683

684684
@_versioned
685685
@_inlineable
686-
internal override var _count: Int64 {
686+
internal override var _count: Int {
687687
return numericCast(_base.count)
688688
}
689689

@@ -1151,7 +1151,7 @@ extension ${Self}: ${SelfProtocol} {
11511151
}
11521152

11531153
@_inlineable
1154-
public func index(_ i: Index, offsetBy n: Int64) -> Index {
1154+
public func index(_ i: Index, offsetBy n: Int) -> Index {
11551155
return AnyIndex(_box: _box._index(i._box, offsetBy: n))
11561156
}
11571157

stdlib/public/core/Mirror.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ extension Mirror {
485485
if case let label as String = e {
486486
position = children.index { $0.label == label } ?? children.endIndex
487487
}
488-
else if let offset = (e as? Int).map({ Int64($0) }) ?? (e as? Int64) {
488+
else if let offset = e as? Int {
489489
position = children.index(children.startIndex,
490490
offsetBy: offset,
491491
limitedBy: children.endIndex) ?? children.endIndex

0 commit comments

Comments
 (0)