FunN Typen konvertieren. FunVoidN Typen werden nicht mehr benutzt

This commit is contained in:
JanUlrich 2016-04-29 15:23:42 +02:00
parent d19414c513
commit d03e20df90
4 changed files with 19 additions and 10 deletions

View File

@ -159,11 +159,11 @@ public class MyCompiler implements MyCompilerAPI{
FunNInterface funN = new FunNInterface(i); FunNInterface funN = new FunNInterface(i);
ret.add(funN.getPublicFieldAssumptions()); ret.add(funN.getPublicFieldAssumptions());
} }
for(int i = 0; i<6; i++){ //Keine FunVoidInterfaces in den Assumptions.
FunVoidNInterface funN = new FunVoidNInterface(i); //for(int i = 0; i<6; i++){
ret.add(funN.getPublicFieldAssumptions()); // FunVoidNInterface funN = new FunVoidNInterface(i);
} // ret.add(funN.getPublicFieldAssumptions());
//}
return ret; return ret;
} }

View File

@ -15,6 +15,7 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
/** /**
* @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke * @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke
@ -143,7 +144,9 @@ public class FunN extends RefType {
//FunN Typen müssen nicht geprüft werden. Sie werden schließlich nur von unserem Typinferenzalgorithmus erstellt: //FunN Typen müssen nicht geprüft werden. Sie werden schließlich nur von unserem Typinferenzalgorithmus erstellt:
List<Type> paraList = new ArrayList<>(); List<Type> paraList = new ArrayList<>();
for(Type t : this.T){ for(Type t : this.T){
paraList.add(t.TYPE(ass, parent)); Type toAdd = t.TYPE(ass, parent);
//if(toAdd == null)throw new TypeinferenceException("Typ "+toAdd+" ist in den Assumptions nicht vorhanden",this);
paraList.add(toAdd);
} }
FunN ret = new FunN(this.R.TYPE(ass, parent),paraList); FunN ret = new FunN(this.R.TYPE(ass, parent),paraList);
return ret; return ret;

View File

@ -2,6 +2,8 @@ package de.dhbwstuttgart.typeinference;
import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.Menge;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.parser.JavaClassName;
@ -85,9 +87,13 @@ public class FunNInterface extends Class{
@Override @Override
public RefType getType() { public RefType getType() {
List<? extends Type> paraList = this.get_ParaList(); List<? extends Type> paraList = this.get_ParaList();
Type R = paraList.get(0); Iterator<? extends Type> paraIter = paraList.iterator();
paraList.remove(0); Type R = paraIter.next();
return new FunN(R, paraList); List<Type> paraListNew = new ArrayList<>();
while(paraIter.hasNext()){
paraListNew.add(paraIter.next());
}
return new FunN(R, paraListNew);
} }

View File

@ -14,7 +14,7 @@ public class FunNType extends UnifyType {
* Creates a FunN-Type with the specified TypeParameters. * Creates a FunN-Type with the specified TypeParameters.
*/ */
protected FunNType(TypeParams p) { protected FunNType(TypeParams p) {
super("FuN", p); super("Fun"+(p.size()-1), p);
} }
/** /**