diff --git a/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav b/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav index 5d9cff2e..ba3e7771 100644 --- a/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav +++ b/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav @@ -9,6 +9,6 @@ public class PaternMatchingHaskellStyle { } public append(LinkedElem(a, r), l2) { - new LinkedElem<>(a, append(r, l2)); + return new LinkedElem<>(a, append(r, l2)); } } diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index 915c3d80..1d314087 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -854,6 +854,29 @@ public class TestComplete { assertEquals(m2.invoke(instance, 10), 10); } + @Ignore("Not implemented") + @Test + public void testOverloadPatternMatching() throws Exception { + var classFiles = generateClassFiles(new ByteArrayClassLoader(), "PaternMatchingHaskellStyle.jav"); + var clazz = classFiles.get("PaternMatchingHaskellStyle"); + var R2 = classFiles.get("Elem"); + var R = classFiles.get("LinkedElem"); + var I = classFiles.get("List"); + + var rctor = R.getDeclaredConstructor(Object.class, I); + var r2ctor = R2.getDeclaredConstructor(Object.class); + + var instance = clazz.getDeclaredConstructor().newInstance(); + var m = clazz.getDeclaredMethod("append", R, I); + + //var x = rctor.newInstance(rctor.newInstance(0, rctor.newInstance(0, r2ctor.newInstance(0))), 0); + //var y = rctor.newInstance(r2ctor.newInstance(0), 0); + + //assertEquals(m.invoke(instance, x, y), 10); + //assertEquals(m.invoke(instance, y, y), 40.0); + + } + @Test public void testOverloadSwitch() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "SwitchOverload.jav"); @@ -868,7 +891,7 @@ public class TestComplete { var x = rctor.newInstance(10); var d = rctor.newInstance(20.0); - assertEquals(m.invoke(instance, x, 0), 50); + assertEquals(m.invoke(instance, x, 0), 10); assertEquals(m.invoke(instance, d, 0), 40.0); }