diff --git a/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav b/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav index a1283113..eff77af3 100644 --- a/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav +++ b/resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav @@ -8,19 +8,14 @@ public record Elem(T a) implements List {} public class PaternMatchingHaskellStyle { public append(LinkedElem(a, b), list2) { - if (b instanceof Elem) { - return handleElem(a, (Elem) b, list2); - } else if (b instanceof LinkedElem) { - return handleLinkedElem(a, (LinkedElem) b, list2); - } - return null; + return handleAppend(a, b, list2); } - private handleElem(a, Elem(e), list2) { - return new LinkedElem<>(a, new LinkedElem<>(e, list2)); + private handleAppend(a, Elem(e), list2) { + return new LinkedElem<>(a, new LinkedElem<>(e, list2));; } - private handleLinkedElem(a, LinkedElem(a,r), list2) { - return new LinkedElem<>(a, append(r, list2)); + private handleAppend(a, LinkedElem(e,r), list2) { + return new LinkedElem<>(a, append(new LinkedElem(e, r), l2)); } } \ No newline at end of file diff --git a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java index ef861a7e..5a80acc8 100644 --- a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java +++ b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java @@ -153,7 +153,7 @@ public class StatementGenerator { : TypePlaceholder.fresh(fp.getStart()); } ret.add(new FormalParameter(paramName, type, fp.getStart())); - localVars.put(paramName, type); + localVars.put(paramName, type); } } return new ParameterList(ret, ret.get(0).getOffset()); diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index 26546098..d018153d 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -854,7 +854,7 @@ public class TestComplete { assertEquals(m2.invoke(instance, 10), 10); } - @Ignore("Not implemented") + //@Ignore("Not implemented") @Test public void testOverloadPatternMatching() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "PaternMatchingHaskellStyle.jav");