Fix Tph4-6
This commit is contained in:
parent
2af59d1e1f
commit
edf85dca7f
@ -1,5 +1,6 @@
|
|||||||
package de.dhbwstuttgart.target.generate;
|
package de.dhbwstuttgart.target.generate;
|
||||||
|
|
||||||
|
import com.google.j2objc.annotations.LoopTranslation;
|
||||||
import de.dhbwstuttgart.bytecode.funN.FunNGenerator;
|
import de.dhbwstuttgart.bytecode.funN.FunNGenerator;
|
||||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||||
import de.dhbwstuttgart.parser.NullToken;
|
import de.dhbwstuttgart.parser.NullToken;
|
||||||
@ -145,7 +146,7 @@ public class ASTToTargetAST {
|
|||||||
findTypeVariables(field.getType(), typeVariablesOfFields);
|
findTypeVariables(field.getType(), typeVariablesOfFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
findTypeVariables(method.getReturnType(), typeVariables);
|
//findTypeVariables(method.getReturnType(), typeVariables);
|
||||||
for (var arg : method.getParameterList().getFormalparalist()) {
|
for (var arg : method.getParameterList().getFormalparalist()) {
|
||||||
findTypeVariables(arg.getType(), typeVariables);
|
findTypeVariables(arg.getType(), typeVariables);
|
||||||
}
|
}
|
||||||
@ -155,6 +156,15 @@ public class ASTToTargetAST {
|
|||||||
public void visit(LocalVarDecl localVarDecl) {
|
public void visit(LocalVarDecl localVarDecl) {
|
||||||
findTypeVariables(localVarDecl.getType(), typeVariables);
|
findTypeVariables(localVarDecl.getType(), typeVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(MethodCall methodCall) {
|
||||||
|
super.visit(methodCall);
|
||||||
|
findTypeVariables(methodCall.getType(), typeVariables);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Assign assign) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Type variables with bounds that are also type variables of the method
|
// Type variables with bounds that are also type variables of the method
|
||||||
@ -221,6 +231,7 @@ public class ASTToTargetAST {
|
|||||||
for (var pair2 : simplifiedConstraints) {
|
for (var pair2 : simplifiedConstraints) {
|
||||||
if (!(pair2.right.equals(tph2) && pair2.left.equals(type)))
|
if (!(pair2.right.equals(tph2) && pair2.left.equals(type)))
|
||||||
continue;
|
continue;
|
||||||
|
if (tph.equals(tph2)) continue;
|
||||||
|
|
||||||
var newPair = new PairTPHsmallerTPH(tph, tph2);
|
var newPair = new PairTPHsmallerTPH(tph, tph2);
|
||||||
newPairs.add(newPair);
|
newPairs.add(newPair);
|
||||||
@ -572,6 +583,8 @@ public class ASTToTargetAST {
|
|||||||
for (var i = 0; i < pars.size(); i++) {
|
for (var i = 0; i < pars.size(); i++) {
|
||||||
var type1 = convert(pars.get(i).getType());
|
var type1 = convert(pars.get(i).getType());
|
||||||
var type2 = convert(arguments.get(i).getType());
|
var type2 = convert(arguments.get(i).getType());
|
||||||
|
if (type2 instanceof TargetGenericType && type1 instanceof TargetGenericType)
|
||||||
|
return true;
|
||||||
if (!type1.equals(type2)) return false;
|
if (!type1.equals(type2)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +349,12 @@ public class TestComplete {
|
|||||||
var instance = classFiles.get("Tph3").getDeclaredConstructor().newInstance();
|
var instance = classFiles.get("Tph3").getDeclaredConstructor().newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void tph4Test() throws Exception {
|
||||||
|
var classFiles = generateClassFiles("Tph4.jav", new ByteArrayClassLoader());
|
||||||
|
var instance = classFiles.get("Tph4").getDeclaredConstructor().newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tph5Test() throws Exception {
|
public void tph5Test() throws Exception {
|
||||||
var classFiles = generateClassFiles("Tph5.jav", new ByteArrayClassLoader());
|
var classFiles = generateClassFiles("Tph5.jav", new ByteArrayClassLoader());
|
||||||
|
Loading…
Reference in New Issue
Block a user