mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Runtime] Fix debugDescription of .self keypaths.
AnyKeyPath's debugDescription assumes there's always at least one component, but `\Type.self` produces an empty keypath. Special-case the empty case to display a `.self` component. rdar://103237845
This commit is contained in:
@@ -3934,7 +3934,8 @@ extension AnyKeyPath: CustomDebugStringConvertible {
|
||||
return withBuffer {
|
||||
var buffer = $0
|
||||
if buffer.data.isEmpty {
|
||||
_internalInvariantFailure("key path has no components")
|
||||
description.append(".self")
|
||||
return description
|
||||
}
|
||||
var valueType: Any.Type = Self.rootType
|
||||
while true {
|
||||
|
||||
Reference in New Issue
Block a user