Skip to content

Commit be8674e

Browse files
committed
Make an internal KeyPath helper final.
And remove an unnecessary override, so that further work will allow this method not to need a vtable entry.
1 parent b89ef78 commit be8674e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public class AnyKeyPath: Hashable, _AppendKeyPath {
134134

135135
// Prevent normal initialization. We use tail allocation via
136136
// allocWithTailElems().
137+
@available(*, unavailable)
137138
internal init() {
138139
_internalInvariantFailure("use _create(...)")
139140
}
@@ -158,7 +159,7 @@ public class AnyKeyPath: Hashable, _AppendKeyPath {
158159
return result
159160
}
160161

161-
internal func withBuffer<T>(_ f: (KeyPathBuffer) throws -> T) rethrows -> T {
162+
final internal func withBuffer<T>(_ f: (KeyPathBuffer) throws -> T) rethrows -> T {
162163
defer { _fixLifetime(self) }
163164

164165
let base = UnsafeRawPointer(Builtin.projectTailElems(self, Int32.self))
@@ -348,14 +349,6 @@ public class ReferenceWritableKeyPath<
348349

349350
internal final override class var kind: Kind { return .reference }
350351

351-
internal final override func _projectMutableAddress(
352-
from base: UnsafePointer<Root>
353-
) -> (pointer: UnsafeMutablePointer<Value>, owner: AnyObject?) {
354-
// Since we're a ReferenceWritableKeyPath, we know we don't mutate the base
355-
// in practice.
356-
return _projectMutableAddress(from: base.pointee)
357-
}
358-
359352
@usableFromInline
360353
internal final func _projectMutableAddress(from origBase: Root)
361354
-> (pointer: UnsafeMutablePointer<Value>, owner: AnyObject?) {

0 commit comments

Comments
 (0)