forked from JavaTX/JavaCompilerCore
new file: ../../AllgemeinTest/Assign.jav
modified: ../../AllgemeinTest/Pair.jav modified: ../../AllgemeinTest/UseWildcardPair.jav modified: ../../../src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java ? extends Object nochmals angepasst modified: ../../../src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java modified: ../../../src/test/java/AllgemeinTest.java
This commit is contained in:
parent
1c31b6d769
commit
506fd0dc0e
10
resources/AllgemeinTest/Assign.jav
Normal file
10
resources/AllgemeinTest/Assign.jav
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class Assign {
|
||||||
|
|
||||||
|
assign(x, y) {
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
assign2(x, y) {
|
||||||
|
assign(x,y);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.lang.Boolean;
|
import java.lang.Boolean;
|
||||||
|
import java.lang.Object;
|
||||||
|
|
||||||
class Pair<U, T> {
|
class Pair<U, T> {
|
||||||
U a;
|
U a;
|
||||||
@ -11,12 +12,17 @@ class Pair<U, T> {
|
|||||||
ret.b = x.elementAt(1);
|
ret.b = x.elementAt(1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
compare(p) {
|
|
||||||
|
|
||||||
return p.a = p.b;
|
eq(a, b) {
|
||||||
|
b = a;
|
||||||
|
return a == b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compare( p) {
|
||||||
|
return eq(p.a, p.b);
|
||||||
|
//return p.a == p.b;
|
||||||
|
}
|
||||||
|
/*
|
||||||
void m(Pair<?, ?> p, List<? extends Eq> b)
|
void m(Pair<?, ?> p, List<? extends Eq> b)
|
||||||
{
|
{
|
||||||
//this.compare(p); //1, type incorrect
|
//this.compare(p); //1, type incorrect
|
||||||
|
@ -170,7 +170,7 @@ public class TypeGenerator {
|
|||||||
return new SuperWildcardType(convert(wildcardContext.wildcardBounds().referenceType(), reg, generics), wildcardContext.getStart());
|
return new SuperWildcardType(convert(wildcardContext.wildcardBounds().referenceType(), reg, generics), wildcardContext.getStart());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return new ExtendsWildcardType(new RefType(new JavaClassName("java.lang.Object"), new NullToken()), wildcardContext.getStart());
|
return new ExtendsWildcardType(ASTFactory.createObjectType(), wildcardContext.getStart());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,8 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
methodCall.receiver.accept(this);
|
methodCall.receiver.accept(this);
|
||||||
//Overloading:
|
//Overloading:
|
||||||
Set<Constraint<Pair>> methodConstraints = new HashSet<>();
|
Set<Constraint<Pair>> methodConstraints = new HashSet<>();
|
||||||
for(MethodAssumption m : this.getMethods(methodCall.name, methodCall.arglist, info)){
|
for(MethodAssumption m :
|
||||||
|
this.getMethods(methodCall.name, methodCall.arglist, info)){
|
||||||
GenericsResolver resolver = getResolverInstance();
|
GenericsResolver resolver = getResolverInstance();
|
||||||
Set<Constraint<Pair>> oneMethodConstraints = generateConstraint(methodCall, m, info, resolver);
|
Set<Constraint<Pair>> oneMethodConstraints = generateConstraint(methodCall, m, info, resolver);
|
||||||
methodConstraints.addAll(oneMethodConstraints);
|
methodConstraints.addAll(oneMethodConstraints);
|
||||||
|
@ -52,8 +52,9 @@ public class AllgemeinTest {
|
|||||||
//String className = "VectorNotObject";
|
//String className = "VectorNotObject";
|
||||||
//String className = "WildcardCaptureConversionTest";
|
//String className = "WildcardCaptureConversionTest";
|
||||||
//String className = "CaptureConversion";
|
//String className = "CaptureConversion";
|
||||||
String className = "Pair";
|
//String className = "Pair";
|
||||||
//String className = "UseWildcardPair";
|
//String className = "UseWildcardPair";
|
||||||
|
String className = "Assign";
|
||||||
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||||
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
|
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
|
||||||
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||||
|
Loading…
Reference in New Issue
Block a user