diff --git a/stdlib/public/core/Arrays.swift.gyb b/stdlib/public/core/Arrays.swift.gyb index a1908da584c..08f9f8d9914 100644 --- a/stdlib/public/core/Arrays.swift.gyb +++ b/stdlib/public/core/Arrays.swift.gyb @@ -247,7 +247,7 @@ public struct ${Self} public subscript(index: Int) -> Element { addressWithNativeOwner { _checkSubscript(index, hoistedIsNativeBuffer: true) - return (UnsafePointer(_buffer.baseAddress + index), + return (UnsafePointer(_buffer.subscriptBaseAddress + index), Builtin.castToNativeObject(_buffer.owner)) } mutableAddressWithPinnedNativeOwner { diff --git a/test/1_stdlib/RangeReplaceable.swift.gyb b/test/1_stdlib/RangeReplaceable.swift.gyb index 78e42da1771..08ea3239762 100644 --- a/test/1_stdlib/RangeReplaceable.swift.gyb +++ b/test/1_stdlib/RangeReplaceable.swift.gyb @@ -105,12 +105,20 @@ if true { RangeReplaceableTestSuite.add${traversal}RangeReplaceableCollectionTests( makeCollection: { (elements: [OpaqueValue]) in +% if Base in other_array_types: + return ${Base}(elements) +% else: return ${Base}(elements: elements) +% end }, wrapValue: identity, extractValue: identity, makeCollectionOfEquatable: { (elements: [MinimalEquatableValue]) in +% if Base in other_array_types: + return ${Base}(elements) +% else: return ${Base}(elements: elements) +% end }, wrapValueIntoEquatable: identityEq, extractValueFromEquatable: identityEq, @@ -118,13 +126,21 @@ if true { RangeReplaceableTestSuite.add${traversal}RangeReplaceableCollectionTests( makeCollection: { (elements: [LifetimeTracked]) in +% if Base in other_array_types: + return ${Base}(elements) +% else: return ${Base}(elements: elements) +% end }, wrapValue: { (element: OpaqueValue) in LifetimeTracked(element.value) }, extractValue: { (element: LifetimeTracked) in OpaqueValue(element.value) }, makeCollectionOfEquatable: { (elements: [MinimalEquatableValue]) in // FIXME: use LifetimeTracked. +% if Base in other_array_types: + return ${Base}(elements) +% else: return ${Base}(elements: elements) +% end }, wrapValueIntoEquatable: identityEq, extractValueFromEquatable: identityEq,