Add an assert to ArrayBuffer.getElementSlowPath.

The implementation is making a strong assumption about the array
element type (single-reference layout), but it is extremely
non-obvious that this helper is only called for those element types.

Swift SVN r30183
This commit is contained in:
Andrew Trick
2015-07-14 05:09:46 +00:00
parent 59f912ac3c
commit 6d03fe0a73

View File

@@ -372,6 +372,7 @@ extension _ArrayBuffer {
@inline(never)
func _getElementSlowPath(i: Int) -> AnyObject {
assert(_isClassOrObjCExistential(Element.self), "Only single reference elements can be indexed here.")
let element: AnyObject
if _isNative {
// _isValidSubscript does no subscript checking for the slow path.