Compare commits

..
1 Commits
Author SHA1 Message Date
dholle 3d456d2ecb Add test case with stackoverflow
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 1m36s
2026-11-18 10:23:02 +01:00
6 changed files with 100 additions and 49 deletions

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
import java.lang.Boolean;
import java.lang.System;
import java.io.PrintStream;
public class Bug463 {
public static and(Boolean a, Boolean b) { return a & b; } // | and ^ behave the same
public static or(Boolean a, Boolean b) { return a | b; }
public static xor(Boolean a, Boolean b) { return a ^ b; }
}
+96
View File
@@ -0,0 +1,96 @@
// 24 type parameters with 24 typed getters: StackOverflowError in unification (20/20 and 24 params with 18 getters compile)
public class Bug468<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20,
T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> {
public T0 f0;
public T1 f1;
public T2 f2;
public T3 f3;
public T4 f4;
public T5 f5;
public T6 f6;
public T7 f7;
public T8 f8;
public T9 f9;
public T10 f10;
public T11 f11;
public T12 f12;
public T13 f13;
public T14 f14;
public T15 f15;
public T16 f16;
public T17 f17;
public T18 f18;
public T19 f19;
public T20 f20;
public T21 f21;
public T22 f22;
public T23 f23;
public T24 f24;
public T25 f25;
public T26 f26;
public T27 f27;
public T28 f28;
public T29 f29;
public T30 f30;
public T31 f31;
public T32 f32;
public T33 f33;
public T34 f34;
public T35 f35;
public T36 f36;
public T37 f37;
public T38 f38;
public T39 f39;
public T40 f40;
public T41 f41;
public T42 f42;
public T43 f43;
public T44 f44;
public T0 g0() { return f0; }
public T1 g1() { return f1; }
public T2 g2() { return f2; }
public T3 g3() { return f3; }
public T4 g4() { return f4; }
public T5 g5() { return f5; }
public T6 g6() { return f6; }
public T7 g7() { return f7; }
public T8 g8() { return f8; }
public T9 g9() { return f9; }
public T10 g10() { return f10; }
public T11 g11() { return f11; }
public T12 g12() { return f12; }
public T13 g13() { return f13; }
public T14 g14() { return f14; }
public T15 g15() { return f15; }
public T16 g16() { return f16; }
public T17 g17() { return f17; }
public T18 g18() { return f18; }
public T19 g19() { return f19; }
public T20 g20() { return f20; }
public T21 g21() { return f21; }
public T22 g22() { return f22; }
public T23 g23() { return f23; }
public T24 g24() { return f24; }
public T25 g25() { return f25; }
public T26 g26() { return f26; }
public T27 g27() { return f27; }
public T28 g28() { return f28; }
public T29 g29() { return f29; }
public T30 g30() { return f30; }
public T31 g31() { return f31; }
public T32 g32() { return f32; }
public T33 g33() { return f33; }
public T34 g34() { return f34; }
public T35 g35() { return f35; }
public T36 g36() { return f36; }
public T37 g37() { return f37; }
public T38 g38() { return f38; }
public T39 g39() { return f39; }
public T40 g40() { return f40; }
public T41 g41() { return f41; }
public T42 g42() { return f42; }
public T43 g43() { return f43; }
public T44 g44() { return f44; }
}
@@ -57,9 +57,4 @@ public record TargetFunNType(String name, List<TargetType> funNParams, List<Targ
} }
return Objects.equals(name, otfn.name); return Objects.equals(name, otfn.name);
} }
@Override
public String toString() {
return toSignature();
}
} }
@@ -357,17 +357,6 @@ public class TYPEStmt implements StatementVisitor {
numericAdditionOrStringConcatenation.add(stringConcat); numericAdditionOrStringConcatenation.add(stringConcat);
} }
} }
if (binary.operation.equals(BinaryExpr.Operator.AND) || binary.operation.equals(BinaryExpr.Operator.OR) || binary.operation.equals(BinaryExpr.Operator.XOR)) {
// Binary operations defined on boolean
if (classNames.contains(bool.getName())) {
Constraint<Pair> boolOp = new Constraint<>();
boolOp.add(new Pair(binary.lexpr.getType(), bool, PairOperator.EQUALSDOT, loc(binary.getOffset())));
boolOp.add(new Pair(binary.rexpr.getType(), bool, PairOperator.EQUALSDOT, loc(binary.getOffset())));
boolOp.add(new Pair(bool, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset())));
numericAdditionOrStringConcatenation.add(boolOp);
}
}
if (numericAdditionOrStringConcatenation.isEmpty()) { if (numericAdditionOrStringConcatenation.isEmpty()) {
throw new TypeinferenceException("Kein Typ für " + binary.operation.toString() + " vorhanden", binary.getOffset()); throw new TypeinferenceException("Kein Typ für " + binary.operation.toString() + " vorhanden", binary.getOffset());
} }
@@ -50,9 +50,7 @@ public class Logger {
public static void resetLogs() { public static void resetLogs() {
defaultWriter = null; defaultWriter = null;
try { try {
FileUtils.cleanDirectory(logFolder); FileUtils.cleanDirectory(logFolder);
} catch (FileNotFoundException e) {
// Ignore
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
+3 -21
View File
@@ -1808,27 +1808,9 @@ public class TestComplete {
} }
@Test @Test
public void testBug463() throws Exception { public void testBug468() throws Exception {
var classFiles = generateClassFiles(createClassLoader(), "Bug463.jav"); var classFiles = generateClassFiles(createClassLoader(), "Bug468.jav");
var clazz = classFiles.get("Bug463"); var clazz = classFiles.get("Bug468");
var instance = clazz.getDeclaredConstructor().newInstance(); var instance = clazz.getDeclaredConstructor().newInstance();
var and = clazz.getDeclaredMethod("and", Boolean.class, Boolean.class);
assertEquals(true, and.invoke(instance, true, true));
assertEquals(false, and.invoke(instance, true, false));
assertEquals(false, and.invoke(instance, false, true));
assertEquals(false, and.invoke(instance, false, false));
var or = clazz.getDeclaredMethod("or", Boolean.class, Boolean.class);
assertEquals(true, or.invoke(instance, true, true));
assertEquals(true, or.invoke(instance, true, false));
assertEquals(true, or.invoke(instance, false, true));
assertEquals(false, or.invoke(instance, false, false));
var xor = clazz.getDeclaredMethod("xor", Boolean.class, Boolean.class);
assertEquals(false, xor.invoke(instance, true, true));
assertEquals(true, xor.invoke(instance, true, false));
assertEquals(true, xor.invoke(instance, false, true));
assertEquals(false, xor.invoke(instance, false, false));
} }
} }