Fehler in TYPE beseitigen

This commit is contained in:
JanUlrich 2017-06-30 13:48:59 +02:00
parent d64823ea30
commit fc6040da39
3 changed files with 6 additions and 6 deletions

View File

@ -221,7 +221,7 @@ public class TYPE implements StatementVisitor{
protected Constraint<Pair> generateConstraint(MethodCall forMethod, MethodAssumption assumption, TypeInferenceBlockInformation info){ protected Constraint<Pair> generateConstraint(MethodCall forMethod, MethodAssumption assumption, TypeInferenceBlockInformation info){
Constraint methodConstraint = new Constraint(); Constraint methodConstraint = new Constraint();
methodConstraint.add(ConstraintsFactory.createPair(forMethod.receiver.getType(), assumption.getReceiverType(), PairOperator.SMALLERDOT, info)); methodConstraint.add(ConstraintsFactory.createPair(forMethod.receiver.getType(), assumption.getReceiverType(), PairOperator.SMALLERDOT, info));
methodConstraint.add(ConstraintsFactory.createPair(assumption.getReturnType(), forMethod.getType(), PairOperator.SMALLERDOT, info)); methodConstraint.add(ConstraintsFactory.createPair(assumption.getReturnType(), forMethod.getType(), PairOperator.EQUALSDOT, info));
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info)); methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info));
return methodConstraint; return methodConstraint;
} }
@ -229,8 +229,8 @@ public class TYPE implements StatementVisitor{
protected Set<Pair> generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info) { protected Set<Pair> generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info) {
Set<Pair> ret = new HashSet<>(); Set<Pair> ret = new HashSet<>();
for(int i = 0;i<foMethod.arglist.getArguments().size();i++){ for(int i = 0;i<foMethod.arglist.getArguments().size();i++){
ret.add(ConstraintsFactory.createPair(assumption.getArgTypes().get(i), ret.add(ConstraintsFactory.createPair(foMethod.arglist.getArguments().get(i).getType(),
foMethod.arglist.getArguments().get(i).getType(), PairOperator.SMALLERDOT, info)); assumption.getArgTypes().get(i), PairOperator.SMALLERDOT, info));
} }
return ret; return ret;
} }

View File

@ -1,6 +1,6 @@
class mathStruc<A> { class mathStruc<A> {
mathStruc(A a) { ;} mathStruc(A a) { }
A model(){ A a; return a; } A model(){ A a; return a; }

View File

@ -30,8 +30,8 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
@Test @Test
public void test() throws IOException, ClassNotFoundException { public void test() throws IOException, ClassNotFoundException {
//filesToTest.add(new File(rootDirectory+"Faculty.jav")); filesToTest.add(new File(rootDirectory+"Faculty.jav"));
filesToTest.add(new File(rootDirectory+"mathStruc.jav")); //filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda.jav")); //filesToTest.add(new File(rootDirectory+"Lambda.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda2.jav")); //filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda3.jav")); //filesToTest.add(new File(rootDirectory+"Lambda3.jav"));