modified: TYPEStmt.java
Bei der Addition + Abfragen eingefuegt, ob die Subtypen von Number jeweils import sind. Nur dann werden Annahmen erstellt. modified: ../../../../../test/bytecode/javFiles/Matrix.jav modified: ../../../../../test/bytecode/javFiles/OL.jav
This commit is contained in:
parent
2a5c727400
commit
fd64b84072
@ -223,50 +223,75 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
//Zuerst der Fall für Numerische AusdrücPairOpnumericeratorke, das sind Mul, Mod und Div immer:
|
//Zuerst der Fall für Numerische AusdrücPairOpnumericeratorke, das sind Mul, Mod und Div immer:
|
||||||
//see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17
|
//see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17
|
||||||
//Expression muss zu Numeric Convertierbar sein. also von Numeric erben
|
//Expression muss zu Numeric Convertierbar sein. also von Numeric erben
|
||||||
Constraint<Pair> numeric = new Constraint<>();
|
Constraint<Pair> numeric;
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT));
|
//PL eingefuegt 2018-07-17
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT));
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(bytee.getName())) {
|
||||||
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
numeric = new Constraint<>();
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT));
|
||||||
numeric = new Constraint<>();
|
numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), shortt, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), shortt, PairOperator.SMALLERDOT));
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
}
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
//PL eingefuegt 2018-07-17
|
||||||
numeric = new Constraint<>();
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(shortt.getName())) {
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), integer, PairOperator.SMALLERDOT));
|
numeric = new Constraint<>();
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), integer, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.lexpr.getType(), shortt, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.rexpr.getType(), shortt, PairOperator.SMALLERDOT));
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
||||||
numeric = new Constraint<>();
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), longg, PairOperator.SMALLERDOT));
|
}
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), longg, PairOperator.SMALLERDOT));
|
//PL eingefuegt 2018-07-17
|
||||||
numeric.add(new Pair(binary.getType(), longg, PairOperator.SMALLERDOT));
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(integer.getName())) {
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
numeric = new Constraint<>();
|
||||||
numeric = new Constraint<>();
|
numeric.add(new Pair(binary.lexpr.getType(), integer, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), floatt, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.rexpr.getType(), integer, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), floatt, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
|
||||||
numeric.add(new Pair(binary.getType(), floatt, PairOperator.SMALLERDOT));
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
}
|
||||||
numeric = new Constraint<>();
|
//PL eingefuegt 2018-07-17
|
||||||
numeric.add(new Pair(binary.lexpr.getType(), doublee, PairOperator.SMALLERDOT));
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(longg.getName())) {
|
||||||
numeric.add(new Pair(binary.rexpr.getType(), doublee, PairOperator.SMALLERDOT));
|
numeric = new Constraint<>();
|
||||||
numeric.add(new Pair(binary.getType(), doublee, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.lexpr.getType(), longg, PairOperator.SMALLERDOT));
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
numeric.add(new Pair(binary.rexpr.getType(), longg, PairOperator.SMALLERDOT));
|
||||||
|
numeric.add(new Pair(binary.getType(), longg, PairOperator.SMALLERDOT));
|
||||||
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
|
}
|
||||||
|
//PL eingefuegt 2018-07-17
|
||||||
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(floatt.getName())) {
|
||||||
|
numeric = new Constraint<>();
|
||||||
|
numeric.add(new Pair(binary.lexpr.getType(), floatt, PairOperator.SMALLERDOT));
|
||||||
|
numeric.add(new Pair(binary.rexpr.getType(), floatt, PairOperator.SMALLERDOT));
|
||||||
|
numeric.add(new Pair(binary.getType(), floatt, PairOperator.SMALLERDOT));
|
||||||
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
|
}
|
||||||
|
//PL eingefuegt 2018-07-17
|
||||||
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(doublee.getName())) {
|
||||||
|
numeric = new Constraint<>();
|
||||||
|
numeric.add(new Pair(binary.lexpr.getType(), doublee, PairOperator.SMALLERDOT));
|
||||||
|
numeric.add(new Pair(binary.rexpr.getType(), doublee, PairOperator.SMALLERDOT));
|
||||||
|
numeric.add(new Pair(binary.getType(), doublee, PairOperator.SMALLERDOT));
|
||||||
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
|
}
|
||||||
|
/* PL auskommentiert Anfang 2018-07-17
|
||||||
/*
|
/*
|
||||||
In Java passiert bei den binären Operatoren eine sogenannte Type Promotion:
|
In Java passiert bei den binären Operatoren eine sogenannte Type Promotion:
|
||||||
https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2
|
https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2
|
||||||
Das bedeutet, dass Java die Typen je nach belieben castet, so lange sie nur von Number erben
|
Das bedeutet, dass Java die Typen je nach belieben castet, so lange sie nur von Number erben
|
||||||
*/
|
|
||||||
|
numeric = new Constraint<>();
|
||||||
numeric.add(new Pair(binary.getType(), number, PairOperator.SMALLERDOT));
|
numeric.add(new Pair(binary.getType(), number, PairOperator.SMALLERDOT));
|
||||||
numericAdditionOrStringConcatenation.add(numeric);
|
numericAdditionOrStringConcatenation.add(numeric);
|
||||||
|
* PL auskommentiert Ende 2018-07-17 */
|
||||||
|
|
||||||
if(binary.operation.equals(BinaryExpr.Operator.ADD)) {
|
if(binary.operation.equals(BinaryExpr.Operator.ADD)) {
|
||||||
//Dann kann der Ausdruck auch das aneinanderfügen zweier Strings sein: ("a" + "b") oder (1 + 2)
|
//Dann kann der Ausdruck auch das aneinanderfügen zweier Strings sein: ("a" + "b") oder (1 + 2)
|
||||||
Constraint<Pair> stringConcat = new Constraint<>();
|
if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(string.getName())) {
|
||||||
stringConcat.add(new Pair(binary.lexpr.getType(), string, PairOperator.EQUALSDOT));
|
Constraint<Pair> stringConcat = new Constraint<>();
|
||||||
stringConcat.add(new Pair(binary.rexpr.getType(), string, PairOperator.EQUALSDOT));
|
stringConcat.add(new Pair(binary.lexpr.getType(), string, PairOperator.EQUALSDOT));
|
||||||
stringConcat.add(new Pair(binary.getType(), string, PairOperator.EQUALSDOT));
|
stringConcat.add(new Pair(binary.rexpr.getType(), string, PairOperator.EQUALSDOT));
|
||||||
numericAdditionOrStringConcatenation.add(stringConcat);
|
stringConcat.add(new Pair(binary.getType(), string, PairOperator.EQUALSDOT));
|
||||||
|
numericAdditionOrStringConcatenation.add(stringConcat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
constraintsSet.addOderConstraint(numericAdditionOrStringConcatenation);
|
constraintsSet.addOderConstraint(numericAdditionOrStringConcatenation);
|
||||||
}else if(binary.operation.equals(BinaryExpr.Operator.LESSEQUAL) ||
|
}else if(binary.operation.equals(BinaryExpr.Operator.LESSEQUAL) ||
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.lang.Integer;
|
import java.lang.Integer;
|
||||||
|
import java.lang.Byte;
|
||||||
import java.lang.Boolean;
|
import java.lang.Boolean;
|
||||||
|
|
||||||
public class Matrix extends Vector<Vector<Integer>> {
|
public class Matrix extends Vector<Vector<Integer>> {
|
||||||
@ -8,8 +9,8 @@ public class Matrix extends Vector<Vector<Integer>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Matrix(vv) {
|
Matrix(vv) {
|
||||||
Integer i;
|
//Integer i;
|
||||||
i = 0;
|
var i = 0;
|
||||||
while(i < vv.size()) {
|
while(i < vv.size()) {
|
||||||
// Boolean a = this.add(vv.elementAt(i));
|
// Boolean a = this.add(vv.elementAt(i));
|
||||||
this.add(vv.elementAt(i));
|
this.add(vv.elementAt(i));
|
||||||
|
@ -2,9 +2,9 @@ import java.lang.Integer;
|
|||||||
import java.lang.Double;
|
import java.lang.Double;
|
||||||
|
|
||||||
|
|
||||||
class OL {
|
class OL {
|
||||||
|
|
||||||
m(java.lang.Double x) { return x + x; }
|
m(java.lang.Integer x) { return x + x; }
|
||||||
|
|
||||||
//m(x) { return x || x; }
|
//m(x) { return x || x; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user