Skip to content

Commit 4b2bdc8

Browse files
committed
Adopt the underscored variants of PlaygroundQuickLook, CustomPlaygroundQuickLookable, and _DefaultCustomPlaygroundQuickLookable.
The non-underscored variants are deprecated, but PlaygroundLogger needs to use these types as part of its implementation. The underscored variants exist without deprecations so code which truly needs them (i.e. the standard library and PlaygroundLogger) can use them without warnings. This addresses <rdar://problem/45287607>.
1 parent 6eb061c commit 4b2bdc8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

PlaygroundLogger/PlaygroundLogger/LegacySupport/PlaygroundQuickLook+OpaqueRepresentationSupport.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Foundation
1818
import AppKit
1919
#endif
2020

21-
extension PlaygroundQuickLook {
21+
extension _PlaygroundQuickLook {
2222
func opaqueRepresentation() throws -> LogEntry.OpaqueRepresentation {
2323
// TODO: don't crash in this function; instead, throw an error so we can encode an error log message instead
2424

PlaygroundLogger/PlaygroundLogger/LogEntry+Reflection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ extension LogEntry {
9393
}
9494

9595
// For types which conform to the legacy `CustomPlaygroundQuickLookable` or `_DefaultCustomPlaygroundQuickLookable` protocols, get their `PlaygroundQuickLook` and use that for logging.
96-
else if let customQuickLookable = instance as? CustomPlaygroundQuickLookable {
96+
else if let customQuickLookable = instance as? _CustomPlaygroundQuickLookable {
9797
self = try .init(playgroundQuickLook: customQuickLookable.customPlaygroundQuickLook, name: name, typeName: typeName, summary: generateSummary(for: instance, withTypeName: typeName, using: mirror))
9898
}
99-
else if let defaultQuickLookable = instance as? _DefaultCustomPlaygroundQuickLookable {
99+
else if let defaultQuickLookable = instance as? __DefaultCustomPlaygroundQuickLookable {
100100
self = try .init(playgroundQuickLook: defaultQuickLookable._defaultCustomPlaygroundQuickLook, name: name, typeName: typeName, summary: generateSummary(for: instance, withTypeName: typeName, using: mirror))
101101
}
102102

@@ -130,7 +130,7 @@ extension LogEntry {
130130
}
131131
}
132132

133-
private init(playgroundQuickLook: PlaygroundQuickLook, name: String, typeName: String, summary: String) throws {
133+
private init(playgroundQuickLook: _PlaygroundQuickLook, name: String, typeName: String, summary: String) throws {
134134
// TODO: figure out when to set `preferBriefSummary` to true
135135
self = try .opaque(name: name, typeName: typeName, summary: summary, preferBriefSummary: false, representation: playgroundQuickLook.opaqueRepresentation())
136136
}

PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,12 @@ class LegacyPlaygroundLoggerTests: XCTestCase {
640640
}
641641

642642
func testPlaygroundQuickLookCalledOnce() {
643-
class MyObject : CustomPlaygroundQuickLookable {
643+
class MyObject : _CustomPlaygroundQuickLookable {
644644
var numCalls = 0
645-
var customPlaygroundQuickLook: PlaygroundQuickLook {
645+
var customPlaygroundQuickLook: _PlaygroundQuickLook {
646646
get {
647647
numCalls = numCalls + 1
648-
return PlaygroundQuickLook(reflecting: "Hello world")
648+
return .text("Hello world")
649649
}
650650
}
651651
}

0 commit comments

Comments
 (0)