diff options
author | EgorBo <egorbo@gmail.com> | 2017-12-14 18:24:21 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-12-21 14:56:02 +0300 |
commit | 8668a855526dd9c1ced5a0954e05c9c9769c5903 (patch) | |
tree | a41a110a88a748386cd8538b03a81226179f08b9 /mcs/ilasm | |
parent | c709e42040331878e1fcec4ff178623074c46a66 (diff) |
Default interface methods IL tests from CoreCLR
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/codegen/MethodDef.cs | 3 | ||||
-rw-r--r-- | mcs/ilasm/codegen/TypeDef.cs | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs index 4e9d31c0628..bb40ca0d992 100644 --- a/mcs/ilasm/codegen/MethodDef.cs +++ b/mcs/ilasm/codegen/MethodDef.cs @@ -512,9 +512,6 @@ namespace Mono.ILASM { meth_attr &= ~PEAPI.MethAttr.Abstract; meth_attr |= PEAPI.MethAttr.Static; } else { - if ((inst_list.Count > 0) && type_def.IsInterface && !IsStatic) - Report.Error (start, "Method cannot have body if it is non-static declared in an interface"); - if (IsAbstract) { if (!type_def.IsAbstract) Report.Error (start, String.Format ("Abstract method '{0}' in non-abstract class '{1}'", diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs index f35dca0bd4a..e6d9dc2cdb0 100644 --- a/mcs/ilasm/codegen/TypeDef.cs +++ b/mcs/ilasm/codegen/TypeDef.cs @@ -207,9 +207,9 @@ namespace Mono.ILASM { public void AddMethodDef (MethodDef methoddef) { - if (IsInterface && !methoddef.IsStatic && (!methoddef.IsVirtual || !methoddef.IsAbstract)) { - Report.Warning (methoddef.StartLocation, "Non-virtual or non-abstract instance method in interface, set to such"); - methoddef.Attributes |= PEAPI.MethAttr.Abstract | PEAPI.MethAttr.Virtual; + if (IsInterface && !methoddef.IsStatic && !methoddef.IsVirtual) { + Report.Warning (methoddef.StartLocation, "Non-virtual instance method in interface, set to such"); + methoddef.Attributes |= PEAPI.MethAttr.Virtual; } if (method_table [methoddef.Signature] != null) |