Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2

Conflicts:
	src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

 It looks like you may be committing a merge.
 If this is not correct, please remove the file
	.git/MERGE_HEAD
 and try again.

 Please enter the commit message for your changes. Lines starting
 with '#' will be ignored, and an empty message aborts the commit.

 Committer: Martin Plümicke <pl@macmini_pl.verw.ba-horb.de>

 On branch bytecode2
 Your branch and 'origin/bytecode2' have diverged,
 and have 1 and 2 different commits each, respectively.
   (use "git pull" to merge the remote branch into yours)

 All conflicts fixed but you are still merging.

 Changes to be committed:
	modified:   src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
modified:   src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
This commit is contained in:
Martin Plümicke 2018-12-19 14:08:42 +01:00
commit 83b9f7edb8
2 changed files with 15 additions and 13 deletions

View File

@ -254,7 +254,7 @@ public class TYPEStmt implements StatementVisitor{
numeric = new Constraint<>();
numeric.add(new Pair(binary.lexpr.getType(), integer, PairOperator.SMALLERDOT));
numeric.add(new Pair(binary.rexpr.getType(), integer, PairOperator.SMALLERDOT));
numeric.add(new Pair(binary.getType(), integer, PairOperator.SMALLERDOT));
numeric.add(new Pair(integer, binary.getType(), PairOperator.SMALLERDOT));
numericAdditionOrStringConcatenation.add(numeric);
}
//PL eingefuegt 2018-07-17
@ -262,7 +262,7 @@ public class TYPEStmt implements StatementVisitor{
numeric = new Constraint<>();
numeric.add(new Pair(binary.lexpr.getType(), longg, PairOperator.SMALLERDOT));
numeric.add(new Pair(binary.rexpr.getType(), longg, PairOperator.SMALLERDOT));
numeric.add(new Pair(binary.getType(), longg, PairOperator.SMALLERDOT));
numeric.add(new Pair(longg, binary.getType(), PairOperator.SMALLERDOT));
numericAdditionOrStringConcatenation.add(numeric);
}
//PL eingefuegt 2018-07-17
@ -270,7 +270,7 @@ public class TYPEStmt implements StatementVisitor{
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));
numeric.add(new Pair(floatt, binary.getType(), PairOperator.SMALLERDOT));
numericAdditionOrStringConcatenation.add(numeric);
}
//PL eingefuegt 2018-07-17
@ -278,7 +278,7 @@ public class TYPEStmt implements StatementVisitor{
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));
numeric.add(new Pair(doublee, binary.getType(), PairOperator.SMALLERDOT));
numericAdditionOrStringConcatenation.add(numeric);
}
/* PL auskommentiert Anfang 2018-07-17
@ -298,7 +298,7 @@ public class TYPEStmt implements StatementVisitor{
Constraint<Pair> stringConcat = new Constraint<>();
stringConcat.add(new Pair(binary.lexpr.getType(), string, PairOperator.EQUALSDOT));
stringConcat.add(new Pair(binary.rexpr.getType(), string, PairOperator.EQUALSDOT));
stringConcat.add(new Pair(binary.getType(), string, PairOperator.EQUALSDOT));
stringConcat.add(new Pair(string, binary.getType(), PairOperator.EQUALSDOT));
numericAdditionOrStringConcatenation.add(stringConcat);
}
}

View File

@ -508,39 +508,41 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (!result.isEmpty() && !res.isEmpty() && !isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) {
//Alle Variablen bestimmen die nicht hinzugefügt wurden in a
List<PlaceholderType> vars_a = a.stream().filter(x -> !(x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName())
List<PlaceholderType> vars_a = a.stream().filter(x -> (x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName())
||x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName()))).map(y -> (PlaceholderType)y.getLhsType()).collect(Collectors.toCollection(ArrayList::new));
Set<UnifyPair> fstElemRes = res.iterator().next();
Set<UnifyPair> compRes = fstElemRes.stream().filter(x -> vars_a.contains(((PlaceholderType)x.getLhsType()))).collect(Collectors.toCollection(HashSet::new));
//Alle Variablen bestimmen die nicht hinzugefügt wurden in a_last
List<PlaceholderType> varsLast_a = a_last.stream().filter(x -> !(x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName())
List<PlaceholderType> varsLast_a = a_last.stream().filter(x -> (x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName())
||x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName()))).map(y -> (PlaceholderType)y.getLhsType()).collect(Collectors.toCollection(ArrayList::new));
//erstes Element genügt, da vars immer auf die gleichen Elemente zugeordnet werden muessen
Set<UnifyPair> fstElemResult = result.iterator().next();
Set<UnifyPair> compResult = fstElemResult.stream().filter(x -> varsLast_a.contains(((PlaceholderType)x.getLhsType()))).collect(Collectors.toCollection(HashSet::new));;
if (variance == 1) {
if (oup.compare(compResult, compRes) == -1) {
int resOfCompare = oup.compare(compResult, compRes);
if (resOfCompare == -1) {
writeLog("Geloescht result: " + result);
result = res;
} else {
if (oup.compare(compResult, compRes) == 0) {
if (resOfCompare == 0) {
result.addAll(res);
} //else {
if (oup.compare(compResult, compRes) == 1) {
if (resOfCompare == 1) {
writeLog("Geloescht res: " + res);
//result = result;
}}}
else { if (variance == -1) {
if (oup.compare(compResult, compRes) == 1) {
int resOfCompare = oup.compare(compResult, compRes);
if (resOfCompare == 1) {
writeLog("Geloescht result: " + result);
result = res;
} else {
if (oup.compare(compResult, compRes) == 0) {
if (resOfCompare == 0) {
result.addAll(res);
} else {
if (oup.compare(compResult, compRes) == -1) {
if (resOfCompare == -1) {
writeLog("Geloescht res: " + res);
//result = result;
}}}}