diff --git a/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs b/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs index ae5f7dacf..1f76ae76c 100644 --- a/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs +++ b/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs @@ -1316,6 +1316,19 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem Assert.IsTrue(type.IsStatic); } + [Test] + public void ExtensionMethodTest() + { + ITypeDefinition type = GetTypeDefinition(typeof(StaticClass)); + var method = type.Methods.Single(m => m.Name == "Extension"); + + Assert.IsTrue(method.IsStatic); + Assert.IsTrue(method.IsExtensionMethod); + Assert.IsNull(method.ReducedFrom); + + Assert.IsTrue(type.HasExtensionMethods); + } + [Test] public void NoDefaultConstructorOnStaticClassTest() { diff --git a/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemTestCase.cs b/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemTestCase.cs index 7e3e19989..76b9c4b6f 100644 --- a/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemTestCase.cs +++ b/ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemTestCase.cs @@ -360,7 +360,11 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem new event EventHandler Evt; } - public static class StaticClass { } + public static class StaticClass + { + public static void Extension(this object inst) { } + } + public abstract class AbstractClass { } public class IndexerNonDefaultName diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs index 179150dd9..a414f4a8c 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs @@ -210,7 +210,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation } IMember IMember.MemberDefinition => this; - IMethod IMethod.ReducedFrom => this; + IMethod IMethod.ReducedFrom => null; TypeParameterSubstitution IMember.Substitution => TypeParameterSubstitution.Identity; public ITypeDefinition DeclaringTypeDefinition {