Zwischenstand 2

This commit is contained in:
sebastian 2017-05-11 14:32:19 +02:00
parent ede8ad6d03
commit 1080d8e52e
8 changed files with 62 additions and 10 deletions

View File

@ -85,7 +85,6 @@ public class ConstructInterfaces {
GenericTypeName typeName = new GenericTypeName( context,name);
GenericRefType typeVar = new GenericRefType(typeName, new NullToken());
formalParameters.add(new FormalParameter(name,typeVar , new NullToken() ));
}

View File

@ -53,7 +53,10 @@ public class Interface {
@Override
public String toString() {
return String.format("interface %s < %s > { \n %s \n %s } \n \n " , strucType , generics, fields.toString() , methods.toString());
String res = String.format("interface %s < %s > { \n %s \n %s } \n \n " , strucType , generics, fields.toString() , methods.toString());
res = res.replace("[" , "");
res = res.replace("]" , "");
return res;
}

View File

@ -0,0 +1,7 @@
package de.dhbwstuttgart.strucTypes6;
/**
* Created by sebastian on 11.05.17.
*/
public class Main {
}

26
test/javFiles/testX.jav Normal file
View File

@ -0,0 +1,26 @@
class Main {
main () { return new MyInteger(); }
}
class A {
mt(x,y,z) { return x.sub(y); }
}
interface TVar_5 < TVar_16, TVar_15 > {
TVar_16 add ( TVar_15 x);
TVar_16 sub ( TVar_15 x);
}
class MyInteger implements TVar_5<MyInteger,MyInteger> {
MyInteger add( MyInteger x ) {
return x;
}
MyInteger sub( MyInteger x ) {
return x;
}
}

View File

@ -10,12 +10,17 @@ class A {
mt(x,y,z) { return x.sub(y).add(z); }
}
interface if1<A,B> {
interface TVar_5 < TVar_16, TVar_15 > {
}
TVar_16 add ( TVar_15 x);
class MyInteger {
}
class MyInteger implements TVar_5<MyInteger,MyInteger> {
MyInteger add( MyInteger x );
}

View File

@ -57,10 +57,9 @@ public class ConvertTest {
ClassOrInterface aClass = sf.getClasses().get(1);
Set<ClassOrInterface> typeinfo = new HashSet<>();
ConstraintSet<Constraint> constraints = sf.getClasses().get(0).getConstraints(new TypeInferenceInformation(typeinfo));
ConstraintSet cs = constraints;
//Set<ClassOrInterface> typeinfo = new HashSet<>();
//ConstraintSet<Constraint> constraints = sf.getClasses().get(0).getConstraints(new TypeInferenceInformation(typeinfo));
//ConstraintSet cs = constraints;
AssumptionMap assumptionMap = new AssumptionMap();

View File

@ -0,0 +1,11 @@
interface if1<A,B> {
}

View File

@ -17,10 +17,12 @@ public class JavaTXCompilerTest {
@Test
public void test() throws IOException, ClassNotFoundException {
JavaTXCompiler compiler = new JavaTXCompiler();
compiler.parse(new File(rootDirectory+"Methods.jav"));
compiler.parse(new File(rootDirectory+"testX.jav"));
//compiler.parse(new File(rootDirectory+"Generics.jav"));
//compiler.parse(new File(rootDirectory+"MethodsEasy.jav"));
//compiler.parse(new File(rootDirectory+"Lambda.jav"));
compiler.typeInference();
}
}