forked from JavaTX/JavaCompilerCore
Void Reference-Typen wieder zu Void RefTypes konvertieren
This commit is contained in:
parent
4a6a8d62e3
commit
ca8952a43c
@ -94,6 +94,7 @@ public class Logger {
|
|||||||
|
|
||||||
public static String getWholeLog(){
|
public static String getWholeLog(){
|
||||||
String ret = "";
|
String ret = "";
|
||||||
|
LOG_HISTORY.removeIf((logLine)->logLine==null);
|
||||||
Logger.LOG_HISTORY.sort((log1, log2)->log1.timestamp.compareTo(log2.timestamp));
|
Logger.LOG_HISTORY.sort((log1, log2)->log1.timestamp.compareTo(log2.timestamp));
|
||||||
ret += Logger.LOG_HISTORY.toString();
|
ret += Logger.LOG_HISTORY.toString();
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -15,6 +15,7 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
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.EinzelElement;
|
import de.dhbwstuttgart.typeinference.EinzelElement;
|
||||||
@ -171,6 +172,7 @@ public class UnifyTypeFactory {
|
|||||||
|
|
||||||
public static Type convert(ReferenceType t) {
|
public static Type convert(ReferenceType t) {
|
||||||
//TODO: Hier kann man die GTVs extrahieren
|
//TODO: Hier kann man die GTVs extrahieren
|
||||||
|
if(t.getName() == "void")return new Void(NULL_NODE, 0);
|
||||||
RefType ret = new RefType(t.getName(),null,0);
|
RefType ret = new RefType(t.getName(),null,0);
|
||||||
ret.set_ParaList(convert(t.getTypeParams()));
|
ret.set_ParaList(convert(t.getTypeParams()));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -850,6 +850,38 @@ public class UnifyTest {
|
|||||||
//Assert.assertEquals(expected, actual);
|
//Assert.assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void unifyTestVector(){
|
||||||
|
/*
|
||||||
|
* Vector<T2> < T1
|
||||||
|
* T1 < Vector<String>
|
||||||
|
*/
|
||||||
|
TypeFactory tf = new TypeFactory();
|
||||||
|
FiniteClosureBuilder fcb = new FiniteClosureBuilder();
|
||||||
|
|
||||||
|
UnifyType tphT1 = tf.getPlaceholderType("T1");
|
||||||
|
UnifyType tphT2 = tf.getPlaceholderType("T2");
|
||||||
|
|
||||||
|
UnifyType gtv = tf.getSimpleType("gtv");
|
||||||
|
UnifyType vector = tf.getSimpleType("Vector", gtv);
|
||||||
|
UnifyType vectorE = tf.getSimpleType("Vector", tphT2);
|
||||||
|
UnifyType string = tf.getSimpleType("String");
|
||||||
|
UnifyType vectorString = tf.getSimpleType("Vector", string);
|
||||||
|
|
||||||
|
fcb.add(vector, vector);
|
||||||
|
|
||||||
|
IFiniteClosure fc = fcb.getFiniteClosure();
|
||||||
|
|
||||||
|
Set<UnifyPair> eq = new HashSet<UnifyPair>();
|
||||||
|
eq.add(new UnifyPair(tphT1, vectorString, PairOperator.SMALLERDOT));
|
||||||
|
eq.add(new UnifyPair(vectorE, tphT1, PairOperator.SMALLERDOT));
|
||||||
|
|
||||||
|
Set<Set<UnifyPair>> actual = new TypeUnify().unifySequential(eq, fc);
|
||||||
|
|
||||||
|
System.out.println("Test OverloadingVector:");
|
||||||
|
System.out.println(actual);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void unifyTestOverloading(){
|
public void unifyTestOverloading(){
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user