Skip to content

Fix diagnostics in Objective-C documentation comments appearing on the wrong line #949

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 3 commits into from
Jun 12, 2024

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://129668876

Summary

Now that Clang and Swift emits source ranges for documentation comments the same, we need to remove the DocC workaround that offset Objective-C ranges, otherwise diagnostics for Objective-C documentation comments will appear on the wrong line.

Dependencies

None

Testing

Add some content that will result in warnings to an Objective-C documentation comment and build documentation for it. For example:

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// Some description of my class
///
/// Can link to ``doSomething`` but not to ``NotFoundSymbol`` or <doc:NotFoundArticle>.
///
/// @Metadata {
///    @DisplayName("MyClass")
/// }
@interface MyClass : NSObject

/// Some description of some function
///
/// - Parameter something: This method has no parameters.
/// - Returns: This method doesn't return anything
- (void)doSomething;

@end

NS_ASSUME_NONNULL_END

The various warnings should display for the correct line and column ranges.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary Not applicable

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@anferbui anferbui left a comment

Choose a reason for hiding this comment

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

Small question about the test but LGTM!

},
"start": {
"character": 5,
"line": 10
"character": 4,
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you edit this symbol graph manually or did you generate it from some Objective-C source code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manually. I don't know if a source for this test content exists (anymore).

@d-ronnqvist d-ronnqvist merged commit 38700f2 into swiftlang:main Jun 12, 2024
@d-ronnqvist d-ronnqvist deleted the objc-diagnostic-locations branch June 12, 2024 14:42
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request Jun 17, 2024
…e wrong line (swiftlang#949)

* Remove workaround for offset Objective-C source ranges

rdar://129668876

* Update test data to reflect correct Objective-C source ranges
d-ronnqvist added a commit that referenced this pull request Jun 17, 2024
…e wrong line (#949) (#954)

* Remove workaround for offset Objective-C source ranges

rdar://129668876

* Update test data to reflect correct Objective-C source ranges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants