Skip to content

Commit 3fa6825

Browse files
committed
Update for SE-0096
1 parent 3b57502 commit 3fa6825

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Sources/Basic/JSON.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ enum JSONDecodingError: Swift.Error {
160160
// This allows the code to be portable, and expose a portable API, but it is not
161161
// very efficient.
162162

163-
private let nsBooleanType = NSNumber(value: false).dynamicType
163+
private let nsBooleanType = type(of: NSNumber(value: false))
164164
extension JSON {
165165
private static func convertToJSON(_ object: Any) -> JSON {
166166
switch object {
@@ -173,7 +173,7 @@ extension JSON {
173173
// Check if this is a boolean.
174174
//
175175
// FIXME: This is all rather unfortunate and expensive.
176-
if value.dynamicType === nsBooleanType {
176+
if type(of: value) === nsBooleanType {
177177
return .bool(value != 0)
178178
}
179179

@@ -214,7 +214,7 @@ extension JSON {
214214
return .dictionary(result)
215215

216216
default:
217-
fatalError("unexpected object: \(object) \(object.dynamicType)")
217+
fatalError("unexpected object: \(object) \(type(of: object))")
218218
}
219219
}
220220

Sources/PackageModel/Module.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class Module: ModuleProtocol {
7777
/// The base prefix for the test module, used to associate with the target it tests.
7878
public var basename: String {
7979
guard isTest else {
80-
fatalError("\(self.dynamicType) should be a test module to access basename.")
80+
fatalError("\(type(of: self)) should be a test module to access basename.")
8181
}
8282
precondition(name.hasSuffix(Module.testModuleNameSuffix))
8383
return name[name.startIndex..<name.index(name.endIndex, offsetBy: -Module.testModuleNameSuffix.characters.count)]
@@ -139,6 +139,6 @@ public class ClangModule: Module {
139139

140140
extension Module: CustomStringConvertible {
141141
public var description: String {
142-
return "\(self.dynamicType)(\(name))"
142+
return "\(type(of: self))(\(name))"
143143
}
144144
}

Sources/SourceControl/CheckoutManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,6 @@ public class CheckoutManager {
256256

257257
extension CheckoutManager.RepositoryHandle: CustomStringConvertible {
258258
public var description: String {
259-
return "<\(self.dynamicType) subpath:\(subpath.asString)>"
259+
return "<\(type(of: self)) subpath:\(subpath.asString)>"
260260
}
261261
}

Sources/swiftpm-xctest-helper/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func run() throws {
4949
// otherwise use the name property (which only gives subclass name).
5050
let name: String
5151
if let firstTest = testCaseSuite.tests.first {
52-
name = String(reflecting: firstTest.dynamicType)
52+
name = String(reflecting: type(of: firstTest))
5353
} else {
5454
name = testCaseSuite.name ?? "nil"
5555
}

Tests/POSIXTests/ReaddirTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ReaddirTests: XCTestCase {
3838

3939
do {
4040
var s = dirent()
41-
let n = sizeof(s.d_name.dynamicType)
41+
let n = sizeof(type(of: s.d_name))
4242
withUnsafeMutablePointer(to: &s.d_name) { ptr in
4343
let ptr = unsafeBitCast(ptr, to: UnsafeMutablePointer<UInt8>.self)
4444
for i in 0 ..< n {

0 commit comments

Comments
 (0)