Skip to content

AST: Note the attribute that makes a declaration unavailable - #91369

Open
tshortli wants to merge 2 commits into
swiftlang:mainfrom
tshortli:availability-restriction-notes
Open

AST: Note the attribute that makes a declaration unavailable#91369
tshortli wants to merge 2 commits into
swiftlang:mainfrom
tshortli:availability-restriction-notes

Conversation

@tshortli

Copy link
Copy Markdown
Contributor

Previously, the compiler would emit a note pointing to the unavailable declaration and highlight the range of the attribute that makes the decl unavailable. Unfortunately the highlight is rarely rendered because most frontends only show highlights that are on the same line as the location pointed to by the diagnostic and @available is not usually written on the same line as the declaration it is attached to. Switch to pointing to the attribute itself so that this crucial information is always rendered.

@tshortli

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@tshortli
tshortli enabled auto-merge August 11, 2026 02:30
…ions.

Expose methods on `AvailabilityRestriction` for emission of notes about
attribute responsible for the restriction so that these restrictions can be
shared by multiple kinds of availability diagnostics.
Previously, the compiler would emit a note pointing to the unavailable
declaration and highlight the range of the attribute that makes the decl
unavailable. Unfortunately the highlight is rarely rendered because most
frontends only show highlights that are on the same line as the location
pointed to by the diagnostic and `@available` is not usually written on the
same line as the declaration it is attached to. Switch to pointing to the
attribute itself so that this crucial information is always rendered.
@tshortli
tshortli force-pushed the availability-restriction-notes branch from 4250b1b to 608e869 Compare August 11, 2026 15:04
@tshortli

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@tshortli

Copy link
Copy Markdown
Contributor Author

@swift-ci please test Linux

@tshortli

Copy link
Copy Markdown
Contributor Author

swiftlang/sourcekit-lsp#2750

@swift-ci please test

@tshortli
tshortli disabled auto-merge August 12, 2026 05:25
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.

1 participant