diff --git a/ILSpy.Tests/Search/SearchResultFactoryIconTests.cs b/ILSpy.Tests/Search/SearchResultFactoryIconTests.cs index 1bd44a96d..449771deb 100644 --- a/ILSpy.Tests/Search/SearchResultFactoryIconTests.cs +++ b/ILSpy.Tests/Search/SearchResultFactoryIconTests.cs @@ -91,6 +91,20 @@ public class SearchResultFactoryIconTests icon.BaseImage.Should().BeSameAs(Images.Enum); } + [AvaloniaTest] + public void Protected_Internal_Nested_Type_Gets_Plain_Protected_Overlay() + { + var nested = fixtureType.NestedTypes + .Single(t => t.Name == "NestedProtectedInternal").GetDefinition()!; + + var icon = (LayeredImage)factory.Create(nested).Image; + + // Types map protected-internal to the plain protected badge; only members show + // the combined protected-internal badge. Matches the WPF frontend's type-only + // overlay mapping. + icon.Overlays.Should().Equal(Images.OverlayProtected); + } + [AvaloniaTest] public void Location_Image_Reflects_Declaring_Type_Icon() { @@ -113,5 +127,7 @@ class SearchIconFixture internal interface INested { } enum NestedEnum { None } + + protected internal class NestedProtectedInternal { } } #pragma warning restore CS0169 diff --git a/ILSpy/TreeNodes/TypeTreeNode.cs b/ILSpy/TreeNodes/TypeTreeNode.cs index c96eda29d..6e0f8c299 100644 --- a/ILSpy/TreeNodes/TypeTreeNode.cs +++ b/ILSpy/TreeNodes/TypeTreeNode.cs @@ -75,8 +75,13 @@ namespace ICSharpCode.ILSpy.TreeNodes TypeKind.Enum => Images.Enum, _ => Images.Class, }; - return Images.GetIcon(baseImage, - Images.GetOverlay(type.Accessibility), type.IsStatic); + // Types map protected-internal to the plain protected badge; only members show + // the combined protected-internal badge. Matches the WPF frontend's type-only + // overlay mapping. + var overlay = type.Accessibility == Accessibility.ProtectedOrInternal + ? AccessOverlayIcon.Protected + : Images.GetOverlay(type.Accessibility); + return Images.GetIcon(baseImage, overlay, type.IsStatic); } public override bool CanExpandRecursively => true;