From 3638edfa73d097525be68db58c55c4dd4ae714ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 16 Mar 2018 14:10:40 +0100 Subject: [PATCH] modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java modified: test/javFiles/Matrix.jav Fehler entdeckt, in unifyCase1 fuer die Typen aus FC keine fresh TV getsetzt werden. --- .../typeinference/unify/TypeUnifyTask.java | 13 ++++++++----- test/javFiles/Matrix.jav | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index b741ad58..554c46a2 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -393,7 +393,7 @@ public class TypeUnifyTask extends RecursiveTask>> { } } } - if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result)) { + if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) { return result; } //else result.stream().filter(y -> !isUndefinedPairSet(y)); @@ -749,16 +749,19 @@ public class TypeUnifyTask extends RecursiveTask>> { //System.out.println(i); //if (i == 62) // System.out.println(tqp.toString()); - Optional opt = stdUnify.unify(tqp, thetaPrime); - if (!opt.isPresent()) + Optional opt = stdUnify.unify(tqp.setTypeParams(newTp), thetaPrime); + if (!opt.isPresent()) tpq muesse freshtv gesetzt werden PL 2018-03-16 continue; Unifier unifier = opt.get(); unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams()); Set substitutionSet = new HashSet<>(); - for (Entry sigma : unifier) + for (Entry sigma : unifier) { + if (tqp.getInvolvedPlaceholderTypes().contains(sigma.getKey())) { //PL eingefuegt 2018-03-16 + break; //TypePalceHolder aus dem FC nicht in das substitutionSet } + } substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT)); - + } //List freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben for (UnifyType tq : thetaQs) { Set smaller = fc.smaller(unifier.apply(tq)); diff --git a/test/javFiles/Matrix.jav b/test/javFiles/Matrix.jav index 4ae77640..a680370f 100644 --- a/test/javFiles/Matrix.jav +++ b/test/javFiles/Matrix.jav @@ -17,8 +17,8 @@ class Matrix extends Vector> { var k = 0; while(k < v1.size()) { //erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); - //erg = add1(erg, mul1(v1.elementAt(k), - // m.elementAt(k).elementAt(j))); + erg = add1(erg, mul1(v1.elementAt(k), + m.elementAt(k).elementAt(j))); k++; } v2.addElement(new Integer(erg)); j++; }