From 56c5ec7e182bb03a788e2be904e7e9c2c122e6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 16 Jan 2015 22:02:05 +0100 Subject: [PATCH] Bug in subst in Unfify.java gepatched --- src/de/dhbwstuttgart/syntaxtree/SourceFile.java | 2 +- src/de/dhbwstuttgart/typeinference/unify/Unify.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java index 32856c392..06981250a 100755 --- a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java +++ b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java @@ -800,7 +800,7 @@ public class SourceFile Stream> streamconstraintsclone = indexeset.stream().map(x -> x.stream() .map(i -> constraintsClone.elementAt(i)) .collect(Vector::new, Vector::add, Vector::addAll)); -// Vector> vecconstraintsclone = streamconstraintsclone.collect(Vector::new, Vector::add, Vector::addAll); + //Vector> vecconstraintsclone = streamconstraintsclone.collect(Vector::new, Vector::add, Vector::addAll); //Schritt 4: Unifikation Vector>> vecunifyResult = diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index af7493071..130c43657 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -2358,6 +2358,8 @@ throws MatchException { // Parameterliste durchgehen Vector vTemp = ((RefType)T).get_ParaList(); + Boolean ret = true; //EINGEFUEGT PL 14-01-16: Return darf erst am Ende zurückgegeben werden und nicht in den ifs + //sonst werden nicht alle Elemente der Forschleife durchlaufen for( int i = 0; i < vTemp.size(); i++ ) { Type Temp = (Type)vTemp.elementAt(i); @@ -2374,16 +2376,17 @@ throws MatchException // Typvariable ersetzen Vector vParaListTemp = ((RefType)T).get_ParaList(); vParaListTemp.set( i, o ); // i. Element ersetzen - return true; + ret = true; //GEAENDERT PL 14-01-16 } } if( Temp instanceof RefType ) { Pair PTemp = new Pair( Temp, null); inferencelog.debug(" TV!!!" + PTemp.toString() ); - return Subst( PTemp, 1, a, o, bMitVorbedingung ); + ret = Subst( PTemp, 1, a, o, bMitVorbedingung ); //GEAENDERT PL 14-01-16 } } + return ret; //EINGEFUEGT PL 14-01-16 } // TV substituieren