apple / swift-docc

Documentation compiler that produces rich API reference documentation and interactive tutorials for your Swift framework or package.
https://swift.org/documentation/docc
Apache License 2.0
1.14k stars 118 forks source link

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

Closed d-ronnqvist closed 2 weeks ago

d-ronnqvist commented 2 weeks ago

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.

d-ronnqvist commented 2 weeks ago

@swift-ci please test