modified: resources/bytecode/javFiles/PaternMatchingHaskellStyle.jav
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 43s

modified:   src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java
	modified:   src/test/java/TestComplete.java
This commit is contained in:
pl@gohorb.ba-horb.de 2024-10-25 15:31:48 +02:00
parent aa61f90fb1
commit 7c546834c0
3 changed files with 7 additions and 12 deletions

View File

@ -8,19 +8,14 @@ public record Elem<T>(T a) implements List<T> {}
public class PaternMatchingHaskellStyle { public class PaternMatchingHaskellStyle {
public append(LinkedElem(a, b), list2) { public append(LinkedElem(a, b), list2) {
if (b instanceof Elem<?>) { return handleAppend(a, b, list2);
return handleElem(a, (Elem<?>) b, list2);
} else if (b instanceof LinkedElem<?>) {
return handleLinkedElem(a, (LinkedElem<?>) b, list2);
}
return null;
} }
private handleElem(a, Elem(e), list2) { private handleAppend(a, Elem(e), list2) {
return new LinkedElem<>(a, new LinkedElem<>(e, list2)); return new LinkedElem<>(a, new LinkedElem<>(e, list2));;
} }
private handleLinkedElem(a, LinkedElem(a,r), list2) { private handleAppend(a, LinkedElem(e,r), list2) {
return new LinkedElem<>(a, append(r, list2)); return new LinkedElem<>(a, append(new LinkedElem(e, r), l2));
} }
} }

View File

@ -854,7 +854,7 @@ public class TestComplete {
assertEquals(m2.invoke(instance, 10), 10); assertEquals(m2.invoke(instance, 10), 10);
} }
@Ignore("Not implemented") //@Ignore("Not implemented")
@Test @Test
public void testOverloadPatternMatching() throws Exception { public void testOverloadPatternMatching() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "PaternMatchingHaskellStyle.jav"); var classFiles = generateClassFiles(new ByteArrayClassLoader(), "PaternMatchingHaskellStyle.jav");