diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java index 9fba5a92..f809a843 100755 --- a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java @@ -410,9 +410,10 @@ public class TypeAssumptions { public ClassAssumption getClassAssumptionFor(RefType t){ for(ClassAssumption cA : this.getClassAssumptions()){ - if(cA.getAssumedClass().getType().equals(t))return cA; + RefType classType = cA.getAssumedClass().getType(); + if(classType.get_Name().equals(t.get_Name()))return cA; } - throw new TypeinferenceException("Der Typ "+t+" ist nicht in den Assumptions vorhanden", t); + throw new TypeinferenceException("Die Klasse für den Typ "+t+" ist nicht in den Assumptions vorhanden", t); } public Type checkType(RefType type, SyntaxTreeNode parent) { diff --git a/test/bytecode/Matrix_lambda.jav b/test/bytecode/Matrix_lambda.jav index 8b318125..293f776e 100644 --- a/test/bytecode/Matrix_lambda.jav +++ b/test/bytecode/Matrix_lambda.jav @@ -1,5 +1,5 @@ -import de.dhbwstuttgart.typeinference.Menge; +import java.util.Vector; -class Matrix extends Menge> { +class Matrix extends Vector> { op = (Matrix m) -> (f) -> f.apply(this, m); } \ No newline at end of file diff --git a/test/bytecode/Matrix_lambda2.jav b/test/bytecode/Matrix_lambda2.jav new file mode 100644 index 00000000..f41dec6d --- /dev/null +++ b/test/bytecode/Matrix_lambda2.jav @@ -0,0 +1,4 @@ + +class Matrix { + op = (f) -> f.apply(2); +} \ No newline at end of file diff --git a/test/bytecode/Matrix_lambdaTest2.java b/test/bytecode/Matrix_lambdaTest2.java new file mode 100644 index 00000000..aa6ec4fd --- /dev/null +++ b/test/bytecode/Matrix_lambdaTest2.java @@ -0,0 +1,14 @@ +package bytecode; + +import org.junit.Test; + +public class Matrix_lambdaTest2 { + public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + public final static String testFile = "Matrix_lambda2.jav"; + public final static String outputFile = "Matrix_lambda2.class"; + + @Test + public void test() { + SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + } +}