diff --git a/src/IKVM.Tests/Runtime/DefaultInterfaceMethodTests.cs b/src/IKVM.Tests/Runtime/DefaultInterfaceMethodTests.cs new file mode 100644 index 0000000000..39a15993c8 --- /dev/null +++ b/src/IKVM.Tests/Runtime/DefaultInterfaceMethodTests.cs @@ -0,0 +1,68 @@ +using FluentAssertions; + +using IKVM.Tests.Util; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.Tests.Runtime +{ + + [TestClass] + public class DefaultInterfaceMethodTests + { + + [TestMethod] + [Ignore] + public void ShouldResolveOverlappingDefaultImplementation() + { + var code = @" + +public class TestClass { + + public static interface CommandInteractionPayload { + + int getValue(); + + } + + public static interface CommandInteraction extends CommandInteractionPayload { + + } + + public static interface CommandInteractionPayloadMixin extends CommandInteractionPayload { + + @Override + default int getValue() { + return 1; + } + + } + + public static class CommandInteractionImpl implements CommandInteraction, CommandInteractionPayloadMixin { + + } + + public static interface SlashCommandInteraction extends CommandInteraction { + + } + + public static class SlashCommandInteractionImpl extends CommandInteractionImpl implements SlashCommandInteraction { + + } + +} + +"; + var unit = new InMemoryCodeUnit("TestClass", code); + var compiler = new InMemoryCompiler(new[] { unit }); + compiler.Compile(); + + var clazz = compiler.GetClass("TestClass$SlashCommandInteractionImpl"); + var ctor = clazz.getConstructor(); + dynamic test = ctor.newInstance(System.Array.Empty()); + ((int)test.getValue()).Should().Be(1); + } + + } + +}