Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,8 @@ private static void GetExportedTypes(NamespaceOrTypeSymbol symbol, int parentInd
foreach (var member in symbol.GetMembers())
{
var namespaceOrType = member as NamespaceOrTypeSymbol;
if ((object)namespaceOrType != null)
if ((object)namespaceOrType != null &&
member is not NamedTypeSymbol { IsExtension: true }) // https://github.com/dotnet/roslyn/issues/78963 - This is a temporary handling, we should get grouping and marker types processed instead.
{
GetExportedTypes(namespaceOrType, index, builder);
}
Expand Down Expand Up @@ -792,6 +793,11 @@ private static void GetForwardedTypes(
ImmutableArray<NamedTypeSymbol> nested = type.GetTypeMembers(); // Ordered.
for (int i = nested.Length - 1; i >= 0; i--)
{
if (nested[i].IsExtension)
{
continue; // https://github.com/dotnet/roslyn/issues/78963 - This is a temporary handling, we should get grouping and marker types processed instead.
}

stack.Push((nested[i], index));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,29 @@ public class Inner
CheckForwarderEmit(source1, source2, "NS.Forwarded", "NS.Forwarded+Inner");
}

[ClrOnlyFact]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it doesn't seem like this needs to only be run on Clr hosts?

Copy link
Member

Choose a reason for hiding this comment

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

Added a note to #79615 (comment) to audit this class for conditional facts that don't need to be conditional.

[WorkItem("https://github.com/dotnet/roslyn/issues/79894")]
[WorkItem("https://github.com/dotnet/roslyn/issues/78963")]
public void Extensions_01()
{
var source1 = @"
public static class Extensions
{
extension(int)
{
}
}";

var source2 = @"
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Extensions))]
";

// https://github.com/dotnet/roslyn/issues/78963 - The grouping and marker types should be among the forwarded types since they are public.
// They also should be among exported types for library built from source1. Type symbols
// representing extensions from the language perspective should not be in either set.
CheckForwarderEmit(source1, source2, "Extensions");
Copy link
Member

@jjonescz jjonescz Aug 14, 2025

Choose a reason for hiding this comment

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

So the extension members are not forwarded in this temporary fix? That sounds like that wouldn't actually "unblock" anyone since they would get a similar effect just by removing the TypeForwardedToAttribute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the extension members are not forwarded in this temporary fix?

Since no one references them in executable code, that should be fine because design time binds to the real declaration wherever it was moved

Copy link
Contributor Author

@AlekseyTs AlekseyTs Aug 14, 2025

Choose a reason for hiding this comment

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

That sounds like that wouldn't actually "unblock" anyone since they would get a similar effect just by removing the TypeForwardedToAttribute

Note that we are not forwarding grouping and marker types, but the attribute is on the enclosing type and that type is forwarded

}

[ClrOnlyFact]
public void EmitForwarder_Nested_Private()
{
Expand Down