(_ x: T, y: T.Type) where T: P {
- var c1 = x.dynamicType.init(required: 0)
- var c2 = x.dynamicType.init(x: 0) // expected-error{{'required' initializer}}
- var c3 = x.dynamicType.init() // expected-error{{'required' initializer}}
- var c4 = x.dynamicType.init(proto: "")
-
- var cf1: (Double) -> T = x.dynamicType.init
- var cf2: (Int) -> T = x.dynamicType.init // expected-error{{'required' initializer}}
- var cf3: () -> T = x.dynamicType.init // expected-error{{'required' initializer}}
- var cf4: (String) -> T = x.dynamicType.init
-
- var c1a = x.dynamicType.init(required: 0)
- var c2a = x.dynamicType.init(x: 0) // expected-error{{'required' initializer}}
- var c3a = x.dynamicType.init() // expected-error{{'required' initializer}}
- var c4a = x.dynamicType.init(proto: "")
-
- var ci1 = x.init(required: 0) // expected-error{{'init' is a member of the type; insert '.dynamicType' to initialize a new object of the same dynamic type}} {{14-14=.dynamicType}}
- var ci2 = x.init(x: 0) // expected-error{{'init' is a member of the type; insert '.dynamicType' to initialize a new object of the same dynamic type}} {{14-14=.dynamicType}}
- var ci3 = x.init() // expected-error{{'init' is a member of the type; insert '.dynamicType' to initialize a new object of the same dynamic type}} {{14-14=.dynamicType}}
- var ci4 = x.init(proto: "") // expected-error{{'init' is a member of the type; insert '.dynamicType' to initialize a new object of the same dynamic type}} {{14-14=.dynamicType}}
+ var c1 = type(of: x).init(required: 0)
+ var c2 = type(of: x).init(x: 0) // expected-error{{'required' initializer}}
+ var c3 = type(of: x).init() // expected-error{{'required' initializer}}
+ var c4 = type(of: x).init(proto: "")
+
+ var cf1: (Double) -> T = type(of: x).init
+ var cf2: (Int) -> T = type(of: x).init // expected-error{{'required' initializer}}
+ var cf3: () -> T = type(of: x).init // expected-error{{'required' initializer}}
+ var cf4: (String) -> T = type(of: x).init
+
+ var c1a = type(of: x).init(required: 0)
+ var c2a = type(of: x).init(x: 0) // expected-error{{'required' initializer}}
+ var c3a = type(of: x).init() // expected-error{{'required' initializer}}
+ var c4a = type(of: x).init(proto: "")
+
+ var ci1 = x.init(required: 0) // expected-error{{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{15-15=type(of: }} {{19-19=)}}
+ var ci2 = x.init(x: 0) // expected-error{{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{15-15=type(of: }} {{19-19=)}}
+ var ci3 = x.init() // expected-error{{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{15-15=type(of: }} {{19-19=)}}
+ var ci4 = x.init(proto: "") // expected-error{{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{15-15=type(of: }} {{19-19=)}}
var ci1a = x(required: 0) // expected-error{{cannot call value of non-function type 'T'}}
var ci2a = x(x: 0) // expected-error{{cannot call value of non-function type 'T'}}
diff --git a/test/expr/unary/selector/selector.swift b/test/expr/unary/selector/selector.swift
index 9b67a5777948f..2ce61993eecc4 100644
--- a/test/expr/unary/selector/selector.swift
+++ b/test/expr/unary/selector/selector.swift
@@ -65,8 +65,8 @@ func testSelector(_ c1: C1, p1: P1, obj: AnyObject) {
_ = #selector(P1.method5(_:b:)) // expected-error{{static member 'method5(_:b:)' cannot be used on protocol metatype 'P1.Protocol'}}
_ = #selector(p1.method4)
_ = #selector(p1.method4(_:b:))
- _ = #selector(p1.dynamicType.method5)
- _ = #selector(p1.dynamicType.method5(_:b:))
+ _ = #selector(type(of: p1).method5)
+ _ = #selector(type(of: p1).method5(_:b:))
// Interesting expressions that refer to methods.
_ = #selector(Swift.AnyObject.method1)
diff --git a/test/stmt/errors.swift b/test/stmt/errors.swift
index d1527ad18cad1..bee61d8d4778f 100644
--- a/test/stmt/errors.swift
+++ b/test/stmt/errors.swift
@@ -104,7 +104,7 @@ protocol ThrowingProto {
func testExistential(_ p : ThrowingProto) throws {
try p.foo()
- try p.dynamicType.bar()
+ try type(of: p).bar()
}
func testGeneric(p : P) throws {
try p.foo()
diff --git a/test/type/metatype/metatypes.swift b/test/type/metatype/metatypes.swift
index 6917a792565c7..6aae31ba448b1 100644
--- a/test/type/metatype/metatypes.swift
+++ b/test/type/metatype/metatypes.swift
@@ -17,4 +17,4 @@ Test1b.foo()
var test1 = Test1a.self
test1 = Test1b.self
var x = Test1b()
-test1 = x.dynamicType
+test1 = type(of: x)
diff --git a/validation-test/stdlib/IOKitOverlay.swift b/validation-test/stdlib/IOKitOverlay.swift
index 8c4494d92a345..9c057a71f0da2 100644
--- a/validation-test/stdlib/IOKitOverlay.swift
+++ b/validation-test/stdlib/IOKitOverlay.swift
@@ -18,7 +18,7 @@ IOKitTests.test("IOReturn value") {
IOKitTests.test("IOReturn type") {
let manager = IOHIDManagerCreate(nil, 0)
let result = IOHIDManagerClose(manager, 0)
- expectTrue(result.dynamicType == kIOReturnNotOpen.dynamicType)
+ expectTrue(type(of: result) == type(of: kIOReturnNotOpen))
}
runAllTests()
diff --git a/validation-test/stdlib/Set.swift b/validation-test/stdlib/Set.swift
index d48239faa371d..88456d3e7b313 100644
--- a/validation-test/stdlib/Set.swift
+++ b/validation-test/stdlib/Set.swift
@@ -137,12 +137,12 @@ func isNativeSet(_ s: Set) -> Bool {
#if _runtime(_ObjC)
func isNativeNSSet(_ s: NSSet) -> Bool {
- let className: NSString = NSStringFromClass(s.dynamicType) as NSString
+ let className: NSString = NSStringFromClass(type(of: s)) as NSString
return className.range(of: "NativeSetStorage").length > 0
}
func isCocoaNSSet(_ s: NSSet) -> Bool {
- let className: NSString = NSStringFromClass(s.dynamicType) as NSString
+ let className: NSString = NSStringFromClass(type(of: s)) as NSString
return className.range(of: "NSSet").length > 0 ||
className.range(of: "NSCFSet").length > 0
}