Unify Bugfix Bug 5 geloest und fuer TypVar <. RefType: ? extends Ty <. RefType eingefuegt

This commit is contained in:
Dr. Martin Pluemicke 2015-03-05 13:55:21 +01:00
parent 618847bf4f
commit 7889783e8a
3 changed files with 36 additions and 2 deletions

View File

@ -804,7 +804,14 @@ public class SourceFile
//Schritt 4: Unifikation
Vector<Vector<Vector<Pair>>> vecunifyResult =
streamconstraintsclone.map(x -> Unify.unify(x, finiteClosure)).collect(Vector::new, Vector::add, Vector::addAll);
//streamconstraintsclone.map(x -> Unify.unify(x, finiteClosure)).collect(Vector::new, Vector::add, Vector::addAll);
//DEBUG-Variante
streamconstraintsclone.map(x ->
{ Vector<Vector<Pair>> z = Unify.unify(x, finiteClosure);
return z;
}
).collect(Vector::new, Vector::add, Vector::addAll);
//card gibt die Cardinalitaet der unifizierten Mengen an
Vector<Integer> card = vecunifyResult.stream().map(x -> x.size()).collect(Vector::new, Vector::add, Vector::addAll);

View File

@ -7,6 +7,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import java.util.stream.Stream;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.Section;
@ -443,7 +444,25 @@ public class Unify
}
}
}
//aus {ty <. ty'} {? extends ty <. ty'} erzeugen //angefuegt PL 15-03-03
Stream<Vector<Pair>> extergMenge1 =
ergMenge1.stream().map(v ->
v.stream().map(pa ->
new Pair(new ExtendsWildcardType(pa.getTA1Copy().getOffset(), pa.getTA1Copy()), pa.getTA2Copy(), pa.GetOperator(), pa.bSubst)
).collect(Vector::new, Vector::add, Vector::addAll));
cartProduktSets.add(ergMenge1);
cartProduktSets.add(extergMenge1.collect(Vector::new, Vector::add, Vector::addAll));
}
else if(p.OperatorSmaller() && p.TA2 instanceof GenericTypeVar)
{
//Paar unverändert lassen, wenn eine GenericTypeVar ist
Vector<Vector<Pair>> setofsetofpairs = new Vector<Vector<Pair>>();
Vector<Pair> vTmp = new Vector<Pair>();
vTmp.add(p);
setofsetofpairs.add(vTmp);
cartProduktSets.add(setofsetofpairs);
}
else if(p.OperatorSmallerExtends())
{
@ -582,6 +601,10 @@ public class Unify
cartProduktSets.add(setofsetofpairs);
}
}
else {
//kein programmierter Fall konnte angewandt werden. PL 15-03-05
return new Vector<Vector<Pair>>();
}
}
else if (p.TA2 instanceof TypePlaceholder)
{
@ -725,6 +748,10 @@ public class Unify
cartProduktSets.add(generateSetOfSetOfPair(p.TA2,grErg));
}
}
else {
//kein programmierter Fall konnte angewandt werden. PL 15-03-05
return new Vector<Vector<Pair>>();
}
}
}
//Schritt 4, Teil 2: Kartesisches Produkt bilden.

View File

@ -1,3 +1,3 @@
class GenericParaListInsertTest{
methode(a){return a;}
<A, ABH extends A, C extends ABH, D, E extends D> A methode(a){return a;}
}