Fehler in TypeDeplyment behoben

This commit is contained in:
JanUlrich 2015-09-28 16:35:01 +02:00
parent 46291a6056
commit 1371220249
6 changed files with 16 additions and 15 deletions

View File

@ -29,6 +29,7 @@ import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.FunN; import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.FunVoidN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType; import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.RefType;
@ -37,7 +38,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.WildcardType; import de.dhbwstuttgart.syntaxtree.type.WildcardType;
import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.FunVoidN;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.OderConstraint; import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;

View File

@ -1,4 +1,4 @@
package de.dhbwstuttgart.typeinference; package de.dhbwstuttgart.syntaxtree.type;
import java.util.Iterator; import java.util.Iterator;
@ -7,22 +7,15 @@ import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList; import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
/** /**
* @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke * FunVoid<T1,...,TN> {
* "interface FunN<R,T1, T2, ... ,TN> { R apply(T1 arg1, T2 arg2, ... , TN argN); }" * void apply(T1 arg1, ... TN argN);
* }
* @author A10023 - Andreas Stadelmeier * @author A10023 - Andreas Stadelmeier
* *
* Bemerkung:
* FunN ist ein RefType. Der RefType ist nicht mit einem FunNInterface verbunden.
*
*/ */
public class FunVoidN extends FunN { public class FunVoidN extends FunN {

View File

@ -234,6 +234,10 @@ public abstract class Type extends SyntaxTreeNode implements IItemWithOffset
public JavaCodeResult printJavaCode(ResultSet resultSet){ public JavaCodeResult printJavaCode(ResultSet resultSet){
return new JavaCodeResult(this.name.toString()); return new JavaCodeResult(this.name.toString());
} }
public JavaCodeResult printJavaCode(ResultSet resultSet, boolean resolveTPHs){
return printJavaCode(resultSet);
}
public Type applyResultSet(ResultSet result){ public Type applyResultSet(ResultSet result){
return this.clone(); return this.clone();

View File

@ -401,6 +401,10 @@ public class TypePlaceholder extends ObjectType
return equalType.printJavaCode(resultSet); return equalType.printJavaCode(resultSet);
} }
public JavaCodeResult printJavaCode(ResultSet resultSet, boolean resolveTPHs){
if(resolveTPHs)return printJavaCode(resultSet);
return new JavaCodeResult(this.get_Name());
}
/** /**
* Berechnet die InsertPoints dieses TypePlaceholders. * Berechnet die InsertPoints dieses TypePlaceholders.
* Alle an diesem TypePlaceholder registrierten ITypeReplacementListener werden darauf kontrolliert, * Alle an diesem TypePlaceholder registrierten ITypeReplacementListener werden darauf kontrolliert,

View File

@ -210,9 +210,9 @@ class GenericVarExtendsDeclarationPatch {
public String getInsertString(ResultSet resultSet){ public String getInsertString(ResultSet resultSet){
String ret = ""; String ret = "";
if(this.genericPair != null){ if(this.genericPair != null){
ret += this.genericPair.TA1.printJavaCode(resultSet); ret += this.genericPair.TA1.printJavaCode(resultSet, false);
ret += " extends "; ret += " extends ";
ret += this.genericPair.TA2.printJavaCode(resultSet); ret += this.genericPair.TA2.printJavaCode(resultSet, false);
} }
return ret; return ret;
} }

View File

@ -1,4 +1,4 @@
class Matrix { class Matrix {
op = (f) -> f.apply(2); op = (f) -> f.apply(2);
} }