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 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));
}
}

View File

@ -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());

View File

@ -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");