Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Include fix-it suggestions in deprecation warnings #14560

Merged
merged 1 commit into from
May 8, 2019

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented May 2, 2019

Clang now supports an additional argument to the deprecated attribute that results in a fix-it suggestion, similar to the renamed: argument to the @availability() attribute in Swift:

deprecated

This PR upgrades a couple deprecation warnings to use the new syntax. Some occurrences could not be upgraded, because it looks like fix-it suggestions only work correctly when a member is merely renamed, not moved to another class.

/cc @mapbox/maps-ios

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS build macOS Mapbox Maps SDK for macOS labels May 2, 2019
@1ec5 1ec5 added this to the release-nectar milestone May 2, 2019
@1ec5 1ec5 requested review from friedbunny and a team May 2, 2019 08:06
@1ec5 1ec5 self-assigned this May 2, 2019
Copy link
Contributor

@julianrex julianrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@friedbunny
Copy link
Contributor

Clang now supports...

@1ec5 do you have any sense of how recent this change is in Xcode? I’m fine with requiring a fairly recent version, but it’d be good to know/document.

@1ec5
Copy link
Contributor Author

1ec5 commented May 8, 2019

do you have any sense of how recent this change is in Xcode?

I’d always figured that the replacement argument was added for Swift compatibility, since the renamed argument has been part of Swift’s @available attribute for a long time. But apparently replacement was quietly introduced to the availability attribute in Clang 3.9.0, so it would’ve been available as far back as Xcode 7.0. 👴

@1ec5 1ec5 merged commit f703c6f into master May 8, 2019
@1ec5 1ec5 deleted the 1ec5-deprecated-renamed branch May 8, 2019 05:18
@friedbunny
Copy link
Contributor

Note that jazzy does not support the replacement argument, so if we want to keep deprecated API in our generated documentation, we should:

  • Keep the message argument intact, with a replacement method signature that jazzy can linkify.
  • Keep header documentation for the deprecated method, otherwise jazzy will see it as undocumented and ignore it, keeping it out of docs entirely.

Jazzy docs for a deprecated property with message and replacement arguments:
Screen Shot 2019-05-16 at 4 06 53 PM

Jazzy docs for a deprecated property with just a replacement argument:
Screen Shot 2019-05-16 at 4 06 26 PM

@friedbunny
Copy link
Contributor

Opened realm/jazzy#1072 about replacement support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants