ObjectType eingeführt. Es muss noch Unify angepasst werden

This commit is contained in:
JanUlrich 2015-03-10 12:33:52 +01:00
parent f2bc4f0ffa
commit 324fb27b6d
6 changed files with 18 additions and 13 deletions

View File

@ -17,6 +17,7 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.DoubleType; import de.dhbwstuttgart.syntaxtree.type.DoubleType;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.Type;
@ -154,7 +155,11 @@ public class LambdaExpression extends Expr{
//Die Typen innerhalb von FunN anpassen: //Die Typen innerhalb von FunN anpassen:
Vector<Type> superParamTypes = new Vector<>(); Vector<Type> superParamTypes = new Vector<>();
for(Type pT : paramTypes){ for(Type pT : paramTypes){
superParamTypes.add(new SuperWildcardType(pT.getOffset(), pT)); if(pT instanceof ObjectType){
superParamTypes.add(new SuperWildcardType(pT.getOffset(), (ObjectType) pT));
}else{
superParamTypes.add(pT);
}
} }
Type retType = method_body.getType(); Type retType = method_body.getType();
Type extRetType = retType; Type extRetType = retType;

View File

@ -4,13 +4,13 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
public class FreshSuperWildcardType extends FreshWildcardType implements IMatchable { public class FreshSuperWildcardType extends FreshWildcardType implements IMatchable {
private Type superBoundType; private ObjectType superBoundType;
/** /**
* Author: Arne Lüdtke<br/> * Author: Arne Lüdtke<br/>
* Standard Konstruktor für eine FreshSuperWildcard * Standard Konstruktor für eine FreshSuperWildcard
*/ */
public FreshSuperWildcardType(Type superBound ,SyntaxTreeNode parent, int offset) public FreshSuperWildcardType(ObjectType superBound ,SyntaxTreeNode parent, int offset)
{ {
super(parent,offset); super(parent,offset);
this.superBoundType = superBound; this.superBoundType = superBound;
@ -20,7 +20,7 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
* Author: Arne Lüdtke<br/> * Author: Arne Lüdtke<br/>
* Privater Konstruktor für clone * Privater Konstruktor für clone
*/ */
private FreshSuperWildcardType(Type superBound,SyntaxTreeNode parent,int offset, String name) private FreshSuperWildcardType(ObjectType superBound,SyntaxTreeNode parent,int offset, String name)
{ {
super(parent,offset,name); super(parent,offset,name);
this.superBoundType = superBound; this.superBoundType = superBound;
@ -46,14 +46,14 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
*/ */
public FreshSuperWildcardType clone() public FreshSuperWildcardType clone()
{ {
return new FreshSuperWildcardType(this.superBoundType.clone(),this.getParent(),getOffset(),this.name.toString()); return new FreshSuperWildcardType((ObjectType) this.superBoundType.clone(),this.getParent(),getOffset(),this.name.toString());
} }
/** /**
* Author: Arne Lüdtke<br/> * Author: Arne Lüdtke<br/>
* Gibt die Grenze der Wildcard zurück * Gibt die Grenze der Wildcard zurück
*/ */
public Type get_SuperBound() public ObjectType get_SuperBound()
{ {
return superBoundType; return superBoundType;
} }

View File

@ -28,7 +28,7 @@ import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
// ino.class.RefType.26621.declaration // ino.class.RefType.26621.declaration
public class RefType extends Type implements IMatchable public class RefType extends ObjectType implements IMatchable
// ino.end // ino.end
// ino.class.RefType.26621.body // ino.class.RefType.26621.body
{ {

View File

@ -18,13 +18,13 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
public class SuperWildcardType extends WildcardType implements ITypeContainer, IMatchable{ public class SuperWildcardType extends WildcardType implements ITypeContainer, IMatchable{
private Type superType = null; private ObjectType superType = null;
/** /**
* Author: Arne Lüdtke<br/> * Author: Arne Lüdtke<br/>
* Standard Konstruktor für eine SuperWildcard * Standard Konstruktor für eine SuperWildcard
*/ */
public SuperWildcardType(int offset, Type superType) public SuperWildcardType(int offset, ObjectType superType)
{ {
super(superType.getParent(),offset); super(superType.getParent(),offset);
this.superType = superType; this.superType = superType;
@ -57,7 +57,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
*/ */
public SuperWildcardType clone() public SuperWildcardType clone()
{ {
return new SuperWildcardType(getOffset(), superType.clone()); return new SuperWildcardType(getOffset(), (ObjectType) superType.clone());
} }
@ -149,7 +149,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
@Override @Override
public ConstraintType TYPE(TypeAssumptions ass, SyntaxTreeNode parent) { public ConstraintType TYPE(TypeAssumptions ass, SyntaxTreeNode parent) {
this.superType = this.superType.TYPE(ass, parent).getType(); this.superType = (ObjectType) this.superType.TYPE(ass, parent).getType();
return super.TYPE(ass, parent); return super.TYPE(ass, parent);
} }

View File

@ -27,7 +27,7 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
*/ */
// ino.end // ino.end
// ino.class.TypePlaceholder.26780.declaration // ino.class.TypePlaceholder.26780.declaration
public class TypePlaceholder extends Type public class TypePlaceholder extends ObjectType
// ino.end // ino.end
// ino.class.TypePlaceholder.26780.body // ino.class.TypePlaceholder.26780.body
{ {

View File

@ -15,7 +15,7 @@ import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
* *
*/ */
public class WildcardType extends Type{ public class WildcardType extends ObjectType{
/** /**
* Author: Arne Lüdtke<br/> * Author: Arne Lüdtke<br/>