Browse Source

Bugfix regarding supertyes in AbstractTypeSystem
Renamed DefaultTypeValueProvider to GenericTypeValueProvider

Andreas Mülder 10 years ago
parent
commit
eb3e232d39

+ 1 - 1
plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/inferrer/ExpressionsTypeInferrer.java

@@ -217,7 +217,7 @@ public class ExpressionsTypeInferrer extends AbstractTypeSystemInferrer implemen
 			for (int i = 0; i < parameters.size(); i++) {
 				Type type1 = inferTypeDispatch(parameters.get(i));
 				Type type2 = inferTypeDispatch(args.get(i));
-				assertCompatible(type1, type2, String.format(INCOMPATIBLE_TYPES, type1, type2));
+				assertCompatible(type2, type1, String.format(INCOMPATIBLE_TYPES, type2, type1));
 			}
 		}
 	}

+ 1 - 1
plugins/org.yakindu.base.types/src/org/yakindu/base/types/inferrer/AbstractTypeSystemInferrer.java

@@ -157,7 +157,7 @@ public abstract class AbstractTypeSystemInferrer implements ITypeSystemInferrer
 	protected void assertAssignable(Type varType, Type valueType, String msg) {
 		if (varType == null || valueType == null)
 			return;
-		if (!registry.isSuperType(valueType, varType)) {
+		if (!registry.isSuperType(varType, valueType)) {
 			error(msg != null ? msg : String.format(ASSERT_COMPATIBLE, varType, valueType), NOT_COMPATIBLE_CODE);
 		}
 	}

+ 5 - 4
plugins/org.yakindu.base.types/src/org/yakindu/base/types/typesystem/AbstractTypeSystem.java

@@ -42,7 +42,7 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 	protected Map<Type, Type> conversionRegistry = new HashMap<Type, Type>();
 
 	protected abstract void initBuiltInTypes();
-	
+
 	protected Resource resource;
 
 	public AbstractTypeSystem() {
@@ -58,7 +58,7 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 
 	public Type getType(String type) {
 		Type result = typeRegistry.get(type);
-		if(result == null){
+		if (result == null) {
 			System.err.println("Could not find type " + type);
 		}
 		return result;
@@ -70,6 +70,7 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 			if (isSame(type, entry.getKey())) {
 				return entry.getValue();
 			}
+
 		}
 		return null;
 	}
@@ -121,8 +122,8 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		}
 	}
 
-	public void declareSuperType(Type superType, Type subType) {
-		extendsRegistry.put(superType, subType);
+	public void declareSuperType(Type subType, Type superType) {
+		extendsRegistry.put(subType, superType);
 	}
 
 	public void declareConversion(Type baseType, Type targetType) {