Skip to content

Update for SE-0096 #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/Basic/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ enum JSONDecodingError: Swift.Error {
// This allows the code to be portable, and expose a portable API, but it is not
// very efficient.

private let nsBooleanType = NSNumber(value: false).dynamicType
private let nsBooleanType = type(of: NSNumber(value: false))
extension JSON {
private static func convertToJSON(_ object: Any) -> JSON {
switch object {
Expand All @@ -173,7 +173,7 @@ extension JSON {
// Check if this is a boolean.
//
// FIXME: This is all rather unfortunate and expensive.
if value.dynamicType === nsBooleanType {
if type(of: value) === nsBooleanType {
return .bool(value != 0)
}

Expand Down Expand Up @@ -214,7 +214,7 @@ extension JSON {
return .dictionary(result)

default:
fatalError("unexpected object: \(object) \(object.dynamicType)")
fatalError("unexpected object: \(object) \(type(of: object))")
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/PackageModel/Module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class Module: ModuleProtocol {
/// The base prefix for the test module, used to associate with the target it tests.
public var basename: String {
guard isTest else {
fatalError("\(self.dynamicType) should be a test module to access basename.")
fatalError("\(type(of: self)) should be a test module to access basename.")
}
precondition(name.hasSuffix(Module.testModuleNameSuffix))
return name[name.startIndex..<name.index(name.endIndex, offsetBy: -Module.testModuleNameSuffix.characters.count)]
Expand Down Expand Up @@ -139,6 +139,6 @@ public class ClangModule: Module {

extension Module: CustomStringConvertible {
public var description: String {
return "\(self.dynamicType)(\(name))"
return "\(type(of: self))(\(name))"
}
}
2 changes: 1 addition & 1 deletion Sources/SourceControl/CheckoutManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,6 @@ public class CheckoutManager {

extension CheckoutManager.RepositoryHandle: CustomStringConvertible {
public var description: String {
return "<\(self.dynamicType) subpath:\(subpath.asString)>"
return "<\(type(of: self)) subpath:\(subpath.asString)>"
}
}
2 changes: 1 addition & 1 deletion Sources/swiftpm-xctest-helper/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func run() throws {
// otherwise use the name property (which only gives subclass name).
let name: String
if let firstTest = testCaseSuite.tests.first {
name = String(reflecting: firstTest.dynamicType)
name = String(reflecting: type(of: firstTest))
} else {
name = testCaseSuite.name ?? "nil"
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/POSIXTests/ReaddirTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ReaddirTests: XCTestCase {

do {
var s = dirent()
let n = sizeof(s.d_name.dynamicType)
let n = sizeof(type(of: s.d_name))
withUnsafeMutablePointer(to: &s.d_name) { ptr in
let ptr = unsafeBitCast(ptr, to: UnsafeMutablePointer<UInt8>.self)
for i in 0 ..< n {
Expand Down