From 2259aed00104afd1c3ea740f3f9aa6813189513d Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Wed, 20 Oct 2021 19:27:24 +0900 Subject: [PATCH] Added single test for calling explicitly implemented interface method #104 https://github.com/kekyo/IL2C/pull/104#pullrequestreview-782054327 --- .../TypeRelations/TypeImplements.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs index dd24e7a7..ee29ca3f 100644 --- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs +++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs @@ -39,6 +39,17 @@ public string GetStringFromInt32(int value) } } + public class InstanceImplementExplicitlyType : IInterfaceType1 + { + // It's the instance field, referrer from the method at same type. + private readonly int rhs = 100; + + string IInterfaceType1.GetStringFromInt32(int value) + { + return (value + rhs).ToString(); + } + } + public interface IInterfaceType2 { string GetStringFromInt64(long value); @@ -250,6 +261,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", "InstanceImplementExplicitlyTypeFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementExplicitlyType), typeof(IInterfaceType1) })] [TestCase("223", "InstanceMultipleImplement1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })] [TestCase("223", "InstanceMultipleImplementFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })] [TestCase("323", "InstanceMultipleImplement2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })] @@ -293,6 +305,12 @@ public static string InstanceImplementFromInterface(int value) return inst.GetStringFromInt32(value); } + public static string InstanceImplementExplicitlyTypeFromInterface(int value) + { + IInterfaceType1 inst = new InstanceImplementExplicitlyType(); + return inst.GetStringFromInt32(value); + } + public static string InstanceMultipleImplement1(int value) { var inst = new InstanceMultipleImplementType();