Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Sep 16, 2025

Fixes #80294

@jcouv jcouv self-assigned this Sep 16, 2025
@jcouv jcouv added Area-Compilers Feature - Extension Everything The extension everything feature labels Sep 16, 2025
@jcouv jcouv marked this pull request as ready for review September 16, 2025 14:39
@jcouv jcouv requested a review from a team as a code owner September 16, 2025 14:39
@AlekseyTs AlekseyTs requested a review from jjonescz September 16, 2025 14:44
ExtensionGroupingInfo extensionGroupingInfo = ((SourceMemberContainerTypeSymbol)containingType).GetExtensionGroupingInfo();

foreach (ImmutableArray<SourceNamedTypeSymbol> extensions in extensionGroupingInfo.EnumerateMergedExtensionBlocks())
if (containingType is SourceMemberContainerTypeSymbol sourceContainingType)
Copy link
Contributor

@AlekseyTs AlekseyTs Sep 16, 2025

Choose a reason for hiding this comment

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

if (containingType is SourceMemberContainerTypeSymbol sourceContainingType)

This doesn't look like a proper fix. This just ignores extensions from added modules, however it looks like declarations in added modules aren't ignored in general. #Closed

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any benefit in visiting declarations from added modules? Does this have effect on xml doc comment file? For example, if we stop this component from visiting declarations form added modules (this is probably not the right place to do that though), will any tests fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding is that added modules cannot contribute any doc comments. It was not my goal to address this bigger question in this PR, but adding if (symbol is not SourceNamedTypeSymbol) { return; } in VisitNamedType indeed didn't break any test.

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that added modules cannot contribute any doc comments.

If that is what we think, then a proper fix, in my opinion, would be to stop visiting declarations from added modules in this component. Where exactly the change should be made can be discussed off-line. I do not think it should be the change that was tried. Quite possibly it belongs in the caller of this component.

However, if we think that added modules can contribute doc comments , then most likely extensions should contribute as well, and the change in commit 1 is not correct. More specifically, it does prevent the crash, but most likely doesn't result in correct behavior.

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 1)

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 4)

</doc>
""", GetDocumentationCommentText(comp));
}

Copy link
Member

Choose a reason for hiding this comment

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

trailing whitespace

Suggested change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Feature - Extension Everything The extension everything feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected error is reported when an added module contains an extension block

4 participants