Skip to content

Conversation

TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented Feb 27, 2025

Resolve #928

Respecting the intent of the existing implementation, change Throws documentation for rethrows functions to optional.

  • throws → Required; a diagnostic is triggered if missing.
  • rethrows → Optional; no diagnostic is triggered if missing.
  • none → If a Throws comment is present, a diagnostic is triggered to remove it.

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

One minor comment, but otherwise looks good. Thanks!

let needsThrowsDesc = throwsOrRethrowsKeyword?.tokenKind == .keyword(.throws)

if !needsThrowsDesc && throwsDescription != nil {
if throwsOrRethrowsKeyword?.tokenKind == nil && throwsDescription != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be throwsOrRethrowsKeyword == nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, yes. There's no need to check tokenKind. I'll fix it!

@TTOzzi TTOzzi force-pushed the allow-rethrows-docc-ValidateDocumentationComments branch from b9b8e82 to 8331ba6 Compare February 27, 2025 17:20
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks!

@ahoppen
Copy link
Member

ahoppen commented Feb 27, 2025

Windows failures look unrelated. I’m investigating.

@allevato
Copy link
Member

I saw those same flakes on Windows yesterday; they usually went away on a retry. No idea what was causing them, though.

@TTOzzi TTOzzi force-pushed the allow-rethrows-docc-ValidateDocumentationComments branch from 8331ba6 to 1165ca8 Compare March 3, 2025 23:10
@allevato allevato merged commit 4585480 into swiftlang:main Mar 4, 2025
19 checks passed
@TTOzzi TTOzzi deleted the allow-rethrows-docc-ValidateDocumentationComments branch March 7, 2025 00:33
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.

Incorrect ValidateDocumentationComments warning for rethrows function
3 participants