@@ -453,9 +453,6 @@ public struct Set<Element : Hashable> :
453
453
internal typealias _VariantBuffer = _VariantSetBuffer<Element>
454
454
internal typealias _NativeBuffer = _NativeSetBuffer<Element>
455
455
456
- /// The index type for subscripting the set.
457
- public typealias Index = SetIndex<Element>
458
-
459
456
internal var _variantBuffer: _VariantBuffer
460
457
461
458
/// Creates a new, empty set with at least the specified number of elements'
@@ -1642,9 +1639,6 @@ public struct Dictionary<Key : Hashable, Value> :
1642
1639
/// key-value pair.
1643
1640
public typealias Element = (key: Key, value: Value)
1644
1641
1645
- /// The index type of a dictionary.
1646
- public typealias Index = DictionaryIndex<Key, Value>
1647
-
1648
1642
internal var _variantBuffer: _VariantBuffer
1649
1643
1650
1644
/// Creates an empty dictionary.
@@ -4702,6 +4696,7 @@ internal enum ${Self}IndexRepresentation<${TypeParametersDecl}> {
4702
4696
case _cocoa(_CocoaIndex)
4703
4697
}
4704
4698
4699
+ extension ${Self} {
4705
4700
%{
4706
4701
if Self == 'Set':
4707
4702
SubscriptingWithIndexDoc = """\
@@ -4723,12 +4718,7 @@ elif Self == 'Dictionary':
4723
4718
}%
4724
4719
4725
4720
${SubscriptingWithIndexDoc}
4726
- public struct ${Self}Index<${TypeParametersDecl}> :
4727
- Comparable {
4728
- // FIXME(ABI)#34 (Nesting types in generics): `DictionaryIndex` and `SetIndex` should
4729
- // be nested types (Dictionary.Index and Set.Index).
4730
- // rdar://problem/17002096
4731
-
4721
+ public struct Index : Comparable {
4732
4722
// Index for native buffer is efficient. Index for bridged NS${Self} is
4733
4723
// not, because neither NSEnumerator nor fast enumeration support moving
4734
4724
// backwards. Even if they did, there is another issue: NSEnumerator does
@@ -4747,12 +4737,12 @@ public struct ${Self}Index<${TypeParametersDecl}> :
4747
4737
internal var _value: ${Self}IndexRepresentation<${TypeParameters}>
4748
4738
4749
4739
@_versioned
4750
- internal static func _native(_ index: _NativeIndex) -> ${Self} Index {
4740
+ internal static func _native(_ index: _NativeIndex) -> Index {
4751
4741
return ${Self}Index(_value: ._native(index))
4752
4742
}
4753
4743
#if _runtime(_ObjC)
4754
4744
@_versioned
4755
- internal static func _cocoa(_ index: _CocoaIndex) -> ${Self} Index {
4745
+ internal static func _cocoa(_ index: _CocoaIndex) -> Index {
4756
4746
return ${Self}Index(_value: ._cocoa(index))
4757
4747
}
4758
4748
#endif
@@ -4786,10 +4776,15 @@ public struct ${Self}Index<${TypeParametersDecl}> :
4786
4776
#endif
4787
4777
}
4788
4778
4789
- extension ${Self}Index {
4779
+ }
4780
+
4781
+ public typealias ${Self}Index<${TypeParametersDecl}> =
4782
+ ${Self}<${TypeParameters}>.Index
4783
+
4784
+ extension ${Self}.Index {
4790
4785
public static func == (
4791
- lhs: ${Self}Index <${TypeParameters}>,
4792
- rhs: ${Self}Index <${TypeParameters}>
4786
+ lhs: ${Self}<${TypeParameters}>.Index ,
4787
+ rhs: ${Self}<${TypeParameters}>.Index
4793
4788
) -> Bool {
4794
4789
if _fastPath(lhs._guaranteedNative) {
4795
4790
return lhs._nativeIndex == rhs._nativeIndex
@@ -4810,8 +4805,8 @@ extension ${Self}Index {
4810
4805
}
4811
4806
4812
4807
public static func < (
4813
- lhs: ${Self}Index <${TypeParameters}>,
4814
- rhs: ${Self}Index <${TypeParameters}>
4808
+ lhs: ${Self}<${TypeParameters}>.Index ,
4809
+ rhs: ${Self}<${TypeParameters}>.Index
4815
4810
) -> Bool {
4816
4811
if _fastPath(lhs._guaranteedNative) {
4817
4812
return lhs._nativeIndex < rhs._nativeIndex
0 commit comments