forked from JavaTX/JavaCompilerCore
Backup
This commit is contained in:
parent
4a67a4a58e
commit
2151c4550b
@ -690,6 +690,7 @@ public class SourceFile
|
||||
//////////////////////////////
|
||||
// Unifizierung der Constraints:
|
||||
//////////////////////////////
|
||||
boolean unifyFail = true;
|
||||
for(Vector<Pair> constraints : xConstraints){
|
||||
//Alle durch das Karthesische Produkt entstandenen Möglichkeiten durchgehen:
|
||||
Vector<Vector<Pair>> result = new Vector<Vector<Pair>>();
|
||||
@ -785,6 +786,7 @@ public class SourceFile
|
||||
for(Class klasse : this.KlassenVektor){
|
||||
//Der Unifikationsalgorithmus kann wiederum auch mehrere Lösungen errechnen, diese werden im folgenden durchlaufen:
|
||||
for(Vector<Pair> resultSet : result){
|
||||
unifyFail = false; //Ein Unifiziertes Ergebnis ist entstanden (es kann auch leer sein, das bedeutet nur, dass die Constraints mindestens in einem Fall Sinn ergaben)
|
||||
//Add Result set as a new ReconstructionResult to ret:
|
||||
TypeinferenceResultSet reconstructionResult = new TypeinferenceResultSet(klasse, constraints, new ResultSet(resultSet));
|
||||
ret.add(reconstructionResult);
|
||||
@ -795,11 +797,10 @@ public class SourceFile
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(unifyFail){
|
||||
if(!this.KlassenVektor.isEmpty())throw new TypeinferenceException("Fehler in Typinferierung", this.KlassenVektor.firstElement());
|
||||
}
|
||||
return ret;
|
||||
/*
|
||||
// HOTI: Nur zur Info.Ich habe den Loglevel auf Info geschaltet, damit
|
||||
|
@ -205,14 +205,15 @@ public class DoubleLiteral extends Literal
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
this.setType(assumptions.getTypeFor(new RefType("Double",this.getOffset())));
|
||||
return new ConstraintsSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
JavaCodeResult ret = new JavaCodeResult();
|
||||
ret.attach(""+this.Double);
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
public Vector<SyntaxTreeNode> getChildren() {
|
||||
|
3
test/plugindevelopment/MartinTestCases/Id.jav
Normal file
3
test/plugindevelopment/MartinTestCases/Id.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class Id {
|
||||
<FR, EL extends FR> Fun1<FR, EL> op = (x) -> x;
|
||||
}
|
14
test/plugindevelopment/MartinTestCases/MatrixVectorMul.jav
Normal file
14
test/plugindevelopment/MartinTestCases/MatrixVectorMul.jav
Normal file
@ -0,0 +1,14 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
mvmul(Vector<Integer> v) {
|
||||
i;
|
||||
ele;
|
||||
v.add(1);
|
||||
while (i < v.size()) {
|
||||
|
||||
ele = 5 + v.elementAt(i);
|
||||
}
|
||||
}
|
||||
}
|
5
test/plugindevelopment/MartinTestCases/Matrix_lambda.jav
Normal file
5
test/plugindevelopment/MartinTestCases/Matrix_lambda.jav
Normal file
@ -0,0 +1,5 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
op = (Matrix m) -> (f) -> f.apply(this, m);
|
||||
}
|
6
test/plugindevelopment/MartinTestCases/MethodId.jav
Normal file
6
test/plugindevelopment/MartinTestCases/MethodId.jav
Normal file
@ -0,0 +1,6 @@
|
||||
class MethodId {
|
||||
|
||||
<US, UR extends VW, VW extends US> US m (UR x) {
|
||||
return x;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
class MethodIntegerUse {
|
||||
Fun1<java.lang.Integer, java.lang.Integer> op = (x) -> m(x);
|
||||
|
||||
|
||||
Integer m (Integer x) {
|
||||
return x;
|
||||
}
|
||||
}
|
8
test/plugindevelopment/MartinTestCases/MethodUse.jav
Normal file
8
test/plugindevelopment/MartinTestCases/MethodUse.jav
Normal file
@ -0,0 +1,8 @@
|
||||
class MethodUse {
|
||||
<BV, BU extends BV, AM extends AO, AP extends BU, AO extends BW, BW extends AP> Fun1<BV, AM> op = (x) -> m(x);
|
||||
|
||||
|
||||
<BV, BU extends BV, AM extends AO, AO extends BW, AP extends BU, BW extends AP> AP m (AO x) {
|
||||
return x;
|
||||
}
|
||||
}
|
9
test/plugindevelopment/MartinTestCases/OL3.jav
Normal file
9
test/plugindevelopment/MartinTestCases/OL3.jav
Normal file
@ -0,0 +1,9 @@
|
||||
class Test{
|
||||
String main(){
|
||||
return m(()->{return "Test";});
|
||||
}
|
||||
String m(p){
|
||||
return p.apply();
|
||||
}
|
||||
void m(p){}
|
||||
}
|
3
test/plugindevelopment/MartinTestCases/Plus1.jav
Normal file
3
test/plugindevelopment/MartinTestCases/Plus1.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class Plus1 {
|
||||
Fun1<java.lang.Integer, ? super java.lang.Integer> op = (x) -> x+1;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class Plus1_Float_Double {
|
||||
op = (x) -> x+1.0;
|
||||
}
|
@ -52,11 +52,15 @@ public class Tester extends TypeInsertTester{
|
||||
@Test
|
||||
public void runTests(){
|
||||
Vector<String> testFiles = new Vector<String>();
|
||||
//testFiles.add("OL3.jav");
|
||||
testFiles.add("Plus1_Float_Double.jav");
|
||||
/*
|
||||
testFiles.add("AchimTest1.jav");
|
||||
testFiles.add("MatrixWhile.jav");
|
||||
//testFiles.add("BoundedType1.jav");
|
||||
testFiles.add("BoundedType2.jav");
|
||||
testFiles.add("BoundedType.jav");
|
||||
|
||||
testFiles.add("OL2.jav");
|
||||
testFiles.add("OL.jav");
|
||||
testFiles.add("Simple.jav");
|
||||
|
@ -0,0 +1,37 @@
|
||||
Allgemeine Probleme:
|
||||
|
||||
- Argument von lambda-Aussdrücken hat falsche Typvar: Könnte das darin liegen,
|
||||
dass die Typvar auch in der abstrakten Syntax gelöscht wird?
|
||||
|
||||
- unnötige constraints entfernen
|
||||
|
||||
- Textmarker werden, beim speichern nicht gelöscht, es wird einfach der neue
|
||||
Text hinzugefügt
|
||||
|
||||
Dateien:
|
||||
|
||||
- Id.jav: funktioniert
|
||||
|
||||
- Matrix_lambda.jav: es bleiben TPH im Typ stehen.
|
||||
TPH IM müsste irgend Supertyp von Matrix (this) sein.
|
||||
|
||||
- MethodId.jav: funktioniert;
|
||||
|
||||
- MethodIntegerUse.jav: funktioniert;
|
||||
|
||||
- MethodUse.jav: funktioniert;
|
||||
|
||||
- OL.jav:
|
||||
* java.lang.Float funktioniert als Return-Typ nicht: Parseerror
|
||||
* wenn man beim ersten m einen Typ auswählt wird der vom zweiten m eingetragen
|
||||
warum?
|
||||
In der zweiten Klasse kann man nach dem eintragen nichts mehr auswählen
|
||||
* Wenn man in der zweiten Klassen einen Typ auswählt kann man in der ersten
|
||||
nichts mehr auswählen. Was wird eigetragen?
|
||||
|
||||
- Plus1_Float_Double.jav: Syntax-Error und Nullpointer-Exception
|
||||
|
||||
- Plus1.jav: funktioniert; Frage: gibt es keinen anderen Typ mit +1?
|
||||
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
class Id {
|
||||
<FR, EL extends FR> Fun1<FR, EL> op = (x) -> x;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
mvmul(Vector<Integer> v) {
|
||||
i;
|
||||
ele;
|
||||
v.add(1);
|
||||
while (i < v.size()) {
|
||||
|
||||
ele = 5 + v.elementAt(i);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
<NJ, NI extends NJ, AG extends NI> Fun1<Fun1<NJ, ? extends Fun2< TPH AG, Matrix, TPH IM >>, Matrix> op = (Matrix m) -> (f) -> f.apply(this, m);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
class MethodId {
|
||||
|
||||
<US, UR extends VW, VW extends US> US m (UR x) {
|
||||
return x;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
class MethodIntegerUse {
|
||||
Fun1<java.lang.Integer, java.lang.Integer> op = (x) -> m(x);
|
||||
|
||||
|
||||
Integer m (Integer x) {
|
||||
return x;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
class MethodUse {
|
||||
<BV, BU extends BV, AM extends AO, AP extends BU, AO extends BW, BW extends AP> Fun1<BV, AM> op = (x) -> m(x);
|
||||
|
||||
|
||||
<BV, BU extends BV, AM extends AO, AO extends BW, AP extends BU, BW extends AP> AP m (AO x) {
|
||||
return x;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
|
||||
class OL {
|
||||
|
||||
java.lang.Float m(java.lang.Float x) { return x + x; }
|
||||
|
||||
java.lang.Boolean m(java.lang.Boolean x) {return x || x; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Main {
|
||||
|
||||
main(x) {
|
||||
ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class Plus1 {
|
||||
Fun1<java.lang.Integer, ? super java.lang.Integer> op = (x) -> x+1;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class Plus1_Float_Double {
|
||||
op = (x) -> x+1.0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user