diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java index 730a5861..e1b6661a 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java @@ -229,6 +229,7 @@ public class MethodCall extends Expr if(!(this.type instanceof TypePlaceholder) && !this.type.equals(methodAssumption.getAssumedType()))break; oCons.addConstraint(constraintsFromMethodAssumption(methodAssumption, assumptions)); } + ret.add(oCons); return ret; } @@ -251,7 +252,7 @@ public class MethodCall extends Expr public UndConstraint constraintsFromMethodAssumption(MethodAssumption methodAssumption, TypeAssumptions assumptions){ UndConstraint methodConstraint = new UndConstraint(); //Ein Constraint für den ReturnType der Methode... - methodConstraint.addConstraint(methodAssumption.getAssumedType().TYPE(assumptions, this), type.TYPE(assumptions, this)); + methodConstraint.addConstraint(methodAssumption.getAssumedType().TYPE(assumptions, this), this.getType().TYPE(assumptions, this)); //Ein Constraint für die Parameter der Methode... for(int i=0; i parameterList = new Vector(); - for(Expr argument : methodCall.getArgumentList().expr){ - parameterList.add(argument.getType()); - } - Vector methodAssumptions = assumptions.getMethodAssumptions(methodCall.getName(), parameterList); - if(methodAssumptions.size()==0)throw new TypeinferenceException("Eine Methode "+methodCall.get_Name()+" ist in den Assumptions nicht vorhanden", methodCall); - //Alle möglichen Methoden durchgehen: - for(MethodAssumption methodAssumption : methodAssumptions){ - //Constraint nicht erstellen, falls Rückgabetyp von vorne herein nicht übereinstimmt: - if(!(this.type instanceof TypePlaceholder) && !this.type.equals(methodAssumption.getAssumedType()))break; - ret.addConstraint(constraintsFromMethodAssumption(methodAssumption)); - } - return ret; - } - */ - - -} diff --git a/test/plugindevelopment/TypeInsertTests/SuperTest.jav b/test/plugindevelopment/TypeInsertTests/SuperTest.jav new file mode 100644 index 00000000..3b28814a --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/SuperTest.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +class Klasse1{ + Klasse1(var){} +} + +class Klass2 extends Klasse1{ + + Klass2(){ + super(this); + } +} diff --git a/test/plugindevelopment/TypeInsertTests/SuperTest.java b/test/plugindevelopment/TypeInsertTests/SuperTest.java new file mode 100644 index 00000000..f9d6d375 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/SuperTest.java @@ -0,0 +1,18 @@ +package plugindevelopment.TypeInsertTests; + +import java.util.Vector; + +import org.junit.Test; + +public class SuperTest { + + private static final String TEST_FILE = "SuperTest.jav"; + + @Test + public void run(){ + Vector mustContain = new Vector(); + + MultipleTypesInsertTester.test(this.TEST_FILE, mustContain); + } + +}