Skip to content

Commit

Permalink
Fix icsharpcode#2484: Private modifier incorrectly applied to interfa…
Browse files Browse the repository at this point in the history
…ce static constructors
  • Loading branch information
ElektroKill committed Nov 6, 2021
1 parent d450865 commit f593880
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ int Property3 {
void Method();

#if CS80
static IA()
{

}

void DefaultMethod()
{
Method();
Expand Down
14 changes: 7 additions & 7 deletions ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1995,18 +1995,18 @@ bool NeedsAccessibility(IMember member)
var declaringType = member.DeclaringType;
if (member.IsExplicitInterfaceImplementation)
return false;
if (declaringType != null && declaringType.Kind == TypeKind.Interface) {
return member.Accessibility != Accessibility.Public;
}
switch (member.SymbolKind) {
switch (member.SymbolKind)
{
case SymbolKind.Constructor:
return !member.IsStatic;
case SymbolKind.Destructor:
return false;
case SymbolKind.Method:
return !((IMethod)member).IsLocalFunction;
default:
return true;
if (declaringType?.Kind == TypeKind.Interface)
{
return member.Accessibility != Accessibility.Public;
}
return member is not IMethod method || !method.IsLocalFunction;
}
}

Expand Down

0 comments on commit f593880

Please sign in to comment.