Skip to content

Commit cceb389

Browse files
committed
[stdlib] Set, Dictionary: Make more Cocoa indexy things non-inlinable
1 parent d477420 commit cceb389

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

stdlib/public/core/DictionaryBridging.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,18 +611,21 @@ extension _CocoaDictionary {
611611
}
612612

613613
extension _CocoaDictionary.Index {
614-
@inlinable
614+
@usableFromInline // FIXME(cocoa-index): Make inlinable
615615
@nonobjc
616616
internal var key: AnyObject {
617-
_precondition(currentKeyIndex < allKeys.value,
618-
"Attempting to access Dictionary elements using an invalid index")
619-
return allKeys[currentKeyIndex]
617+
@_effects(readonly)
618+
get {
619+
_precondition(currentKeyIndex < allKeys.value,
620+
"Attempting to access Dictionary elements using an invalid index")
621+
return allKeys[currentKeyIndex]
622+
}
620623
}
621624

622-
@usableFromInline
625+
@usableFromInline // FIXME(cocoa-index): Make inlinable
623626
@nonobjc
624627
internal var age: Int32 {
625-
@_effects(releasenone)
628+
@_effects(readonly)
626629
get {
627630
return _HashTable.age(for: base.object)
628631
}

stdlib/public/core/SetBridging.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ extension _CocoaSet: _SetBuffer {
391391
return object.member(element) != nil
392392
}
393393

394-
@usableFromInline
394+
@usableFromInline // FIXME(cocoa-index): Make inlinable
395395
@_effects(releasenone)
396396
internal func element(at i: Index) -> AnyObject {
397397
let element: AnyObject? = i.element
@@ -447,15 +447,18 @@ extension _CocoaSet {
447447
}
448448

449449
extension _CocoaSet.Index {
450-
@inlinable
450+
@usableFromInline // FIXME(cocoa-index): Make inlinable
451451
@nonobjc
452452
internal var element: AnyObject {
453-
_precondition(currentKeyIndex < allKeys.value,
454-
"Attempting to access Set elements using an invalid index")
455-
return allKeys[currentKeyIndex]
453+
@_effects(readonly)
454+
get {
455+
_precondition(currentKeyIndex < allKeys.value,
456+
"Attempting to access Set elements using an invalid index")
457+
return allKeys[currentKeyIndex]
458+
}
456459
}
457460

458-
@usableFromInline
461+
@usableFromInline // FIXME(cocoa-index): Make inlinable
459462
@nonobjc
460463
internal var age: Int32 {
461464
@_effects(releasenone)

0 commit comments

Comments
 (0)