Skip to content

SR-2747: Recommend type(of:) instead of .dynamicType #4974

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
Sep 28, 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
2 changes: 1 addition & 1 deletion apinotes/ObjectiveC.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Protocols:
- Selector: class
MethodKind: Instance
Availability: nonswift
AvailabilityMsg: use 'dynamicType' instead
AvailabilityMsg: use 'type(of:)' instead
- Selector: 'conformsToProtocol:'
MethodKind: Instance
Nullability:
Expand Down
4 changes: 2 additions & 2 deletions test/ClangModules/availability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func test_NSInvocation(_ x: NSInvocation, // expected-error {{'NSInvocat
z: NSMethodSignature) {} // expected-error {{'NSMethodSignature' is unavailable}}

func test_class_avail(_ x:NSObject, obj: AnyObject) {
x.`class`() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}} expected-warning {{result of call to 'class()' is unused}}
x.`class`() // expected-error {{'class()' is unavailable in Swift: use 'type(of:)' instead}} expected-warning {{result of call to 'class()' is unused}}
_ = NSObject.`class`() // expected-error {{'class()' is unavailable in Swift: use 'self' instead}}
_ = obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}}
_ = obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'type(of:)' instead}}
}

func test_unavailable_app_extension() {
Expand Down