From 65ebbbed8be4d8295c90524b6ea657f618d29e4d Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Wed, 20 Oct 2021 20:27:50 +0900 Subject: [PATCH] Added more test case. #104 https://github.com/kekyo/IL2C/pull/104#pullrequestreview-782054327 --- .../TypeRelations/TypeImplements.cs | 4 ++++ .../TypeRelations/TypeImplements.il | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs index fcba003d..8a86a8f3 100644 --- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs +++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs @@ -262,6 +262,7 @@ public class InstanceMultipleImplement3DepthType : InstanceMultipleImplement2Dep [TestId("TypeRelations")] [TestCase("223", "InstanceImplement", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })] [TestCase("223", "InstanceImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })] + [TestCase("223", "InstanceImplementFromInterfaceByClass", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })] [TestCase("223", "InstanceImplementExplicitlyTypeFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementExplicitlyType), typeof(IInterfaceType1) })] [TestCase("223", "InstanceImplementExplicitlyTypeFromInterfaceByClass", 123, IncludeTypes = new[] { typeof(InstanceImplementExplicitlyType), typeof(IInterfaceType1) })] [TestCase("223", "InstanceMultipleImplement1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })] @@ -307,6 +308,9 @@ public static string InstanceImplementFromInterface(int value) return inst.GetStringFromInt32(value); } + [MethodImpl(MethodImplOptions.ForwardRef)] + public static extern string InstanceImplementFromInterfaceByClass(int value); + public static string InstanceImplementExplicitlyTypeFromInterface(int value) { IInterfaceType1 inst = new InstanceImplementExplicitlyType(); diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.il b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.il index 97ce07e8..1be08a3a 100644 --- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.il +++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.il @@ -1,5 +1,13 @@ .class public IL2C.RuntimeSystems.TypeImplements { + .method public static string InstanceImplementFromInterfaceByClass(int32 v) cil managed + { + .maxstack 2 + newobj instance void IL2C.RuntimeSystems.InstanceImplementType::.ctor() + ldarg.0 + callvirt instance string IL2C.RuntimeSystems.IInterfaceType1::GetStringFromInt32(int32) + ret + } .method public static string InstanceImplementExplicitlyTypeFromInterfaceByClass(int32 v) cil managed { .maxstack 2