Skip to content

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 4, 2026

It’s perfectly fine for mainFilesProvider to be nil if we don’t have an index. We shouldn’t log a fault for that.

It’s perfectly fine for `mainFilesProvider` to be `nil` if we don’t have an index. We shouldn’t log a fault for that.
@ahoppen
Copy link
Member Author

ahoppen commented Jan 4, 2026

@swift-ci Please test


package func mainFilesProvider<T: MainFilesProvider>(as: T.Type) async -> T? {
guard let mainFilesProvider = mainFilesProvider else {
guard let mainFilesProvider = await mainFilesProvider.value else {
Copy link
Member

Choose a reason for hiding this comment

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

This will trap if mainFilesProvider was nil as it's IUO, but I assume it's fine because it's always initialized in init.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes exactly. All the IUO members in SourceKit-LSP should be guaranteed to be initialized in init.

@ahoppen ahoppen merged commit f21da6b into swiftlang:main Jan 16, 2026
3 checks passed
@ahoppen ahoppen deleted the main-files-provider-nil branch January 16, 2026 06:42
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