2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
@@ -743,7 +743,7 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
743
743
internal override func _index(
744
744
_ i: _AnyIndexBox , offsetBy n: Int
745
745
) -> _AnyIndexBox {
746
- return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: numericCast ( n ) ) )
746
+ return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: n ) )
747
747
}
748
748
749
749
@inlinable
@@ -752,10 +752,7 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
752
752
offsetBy n: Int ,
753
753
limitedBy limit: _AnyIndexBox
754
754
) -> _AnyIndexBox ? {
755
- return _base. index (
756
- _unbox ( i) ,
757
- offsetBy: numericCast ( n) ,
758
- limitedBy: _unbox ( limit) )
755
+ return _base. index ( _unbox ( i) , offsetBy: n, limitedBy: _unbox ( limit) )
759
756
. map { _IndexBox ( _base: $0) }
760
757
}
761
758
@@ -764,7 +761,7 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
764
761
_ i: inout _AnyIndexBox , offsetBy n: Int
765
762
) {
766
763
if let box = i as? _IndexBox < S . Index > {
767
- return _base. formIndex ( & box. _base, offsetBy: numericCast ( n ) )
764
+ return _base. formIndex ( & box. _base, offsetBy: n )
768
765
}
769
766
fatalError ( " Index type mismatch! " )
770
767
}
@@ -774,10 +771,7 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
774
771
_ i: inout _AnyIndexBox , offsetBy n: Int , limitedBy limit: _AnyIndexBox
775
772
) -> Bool {
776
773
if let box = i as? _IndexBox < S . Index > {
777
- return _base. formIndex (
778
- & box. _base,
779
- offsetBy: numericCast ( n) ,
780
- limitedBy: _unbox ( limit) )
774
+ return _base. formIndex ( & box. _base, offsetBy: n, limitedBy: _unbox ( limit) )
781
775
}
782
776
fatalError ( " Index type mismatch! " )
783
777
}
@@ -787,12 +781,12 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
787
781
from start: _AnyIndexBox ,
788
782
to end: _AnyIndexBox
789
783
) -> Int {
790
- return numericCast ( _base. distance ( from: _unbox ( start) , to: _unbox ( end) ) )
784
+ return _base. distance ( from: _unbox ( start) , to: _unbox ( end) )
791
785
}
792
786
793
787
@inlinable
794
788
internal override var _count : Int {
795
- return numericCast ( _base. count)
789
+ return _base. count
796
790
}
797
791
798
792
@usableFromInline
@@ -949,7 +943,7 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
949
943
internal override func _index(
950
944
_ i: _AnyIndexBox , offsetBy n: Int
951
945
) -> _AnyIndexBox {
952
- return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: numericCast ( n ) ) )
946
+ return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: n ) )
953
947
}
954
948
955
949
@inlinable
@@ -958,11 +952,7 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
958
952
offsetBy n: Int ,
959
953
limitedBy limit: _AnyIndexBox
960
954
) -> _AnyIndexBox ? {
961
- return _base. index (
962
- _unbox ( i) ,
963
- offsetBy: numericCast ( n) ,
964
- limitedBy: _unbox ( limit)
965
- )
955
+ return _base. index ( _unbox ( i) , offsetBy: n, limitedBy: _unbox ( limit) )
966
956
. map { _IndexBox ( _base: $0) }
967
957
}
968
958
@@ -971,7 +961,7 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
971
961
_ i: inout _AnyIndexBox , offsetBy n: Int
972
962
) {
973
963
if let box = i as? _IndexBox < S . Index > {
974
- return _base. formIndex ( & box. _base, offsetBy: numericCast ( n ) )
964
+ return _base. formIndex ( & box. _base, offsetBy: n )
975
965
}
976
966
fatalError ( " Index type mismatch! " )
977
967
}
@@ -981,10 +971,7 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
981
971
_ i: inout _AnyIndexBox , offsetBy n: Int , limitedBy limit: _AnyIndexBox
982
972
) -> Bool {
983
973
if let box = i as? _IndexBox < S . Index > {
984
- return _base. formIndex (
985
- & box. _base,
986
- offsetBy: numericCast ( n) ,
987
- limitedBy: _unbox ( limit) )
974
+ return _base. formIndex ( & box. _base, offsetBy: n, limitedBy: _unbox ( limit) )
988
975
}
989
976
fatalError ( " Index type mismatch! " )
990
977
}
@@ -994,12 +981,12 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
994
981
from start: _AnyIndexBox ,
995
982
to end: _AnyIndexBox
996
983
) -> Int {
997
- return numericCast ( _base. distance ( from: _unbox ( start) , to: _unbox ( end) ) )
984
+ return _base. distance ( from: _unbox ( start) , to: _unbox ( end) )
998
985
}
999
986
1000
987
@inlinable
1001
988
internal override var _count : Int {
1002
- return numericCast ( _base. count)
989
+ return _base. count
1003
990
}
1004
991
1005
992
@inlinable
@@ -1168,7 +1155,7 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
1168
1155
internal override func _index(
1169
1156
_ i: _AnyIndexBox , offsetBy n: Int
1170
1157
) -> _AnyIndexBox {
1171
- return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: numericCast ( n ) ) )
1158
+ return _IndexBox ( _base: _base. index ( _unbox ( i) , offsetBy: n ) )
1172
1159
}
1173
1160
1174
1161
@inlinable
@@ -1177,11 +1164,7 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
1177
1164
offsetBy n: Int ,
1178
1165
limitedBy limit: _AnyIndexBox
1179
1166
) -> _AnyIndexBox ? {
1180
- return _base. index (
1181
- _unbox ( i) ,
1182
- offsetBy: numericCast ( n) ,
1183
- limitedBy: _unbox ( limit)
1184
- )
1167
+ return _base. index ( _unbox ( i) , offsetBy: n, limitedBy: _unbox ( limit) )
1185
1168
. map { _IndexBox ( _base: $0) }
1186
1169
}
1187
1170
@@ -1190,7 +1173,7 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
1190
1173
_ i: inout _AnyIndexBox , offsetBy n: Int
1191
1174
) {
1192
1175
if let box = i as? _IndexBox < S . Index > {
1193
- return _base. formIndex ( & box. _base, offsetBy: numericCast ( n ) )
1176
+ return _base. formIndex ( & box. _base, offsetBy: n )
1194
1177
}
1195
1178
fatalError ( " Index type mismatch! " )
1196
1179
}
@@ -1200,10 +1183,7 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
1200
1183
_ i: inout _AnyIndexBox , offsetBy n: Int , limitedBy limit: _AnyIndexBox
1201
1184
) -> Bool {
1202
1185
if let box = i as? _IndexBox < S . Index > {
1203
- return _base. formIndex (
1204
- & box. _base,
1205
- offsetBy: numericCast ( n) ,
1206
- limitedBy: _unbox ( limit) )
1186
+ return _base. formIndex ( & box. _base, offsetBy: n, limitedBy: _unbox ( limit) )
1207
1187
}
1208
1188
fatalError ( " Index type mismatch! " )
1209
1189
}
@@ -1213,12 +1193,12 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
1213
1193
from start: _AnyIndexBox ,
1214
1194
to end: _AnyIndexBox
1215
1195
) -> Int {
1216
- return numericCast ( _base. distance ( from: _unbox ( start) , to: _unbox ( end) ) )
1196
+ return _base. distance ( from: _unbox ( start) , to: _unbox ( end) )
1217
1197
}
1218
1198
1219
1199
@inlinable
1220
1200
internal override var _count : Int {
1221
- return numericCast ( _base. count)
1201
+ return _base. count
1222
1202
}
1223
1203
1224
1204
@inlinable
0 commit comments