Browse Source

First draft of new type system implementation

Andreas Mülder 10 years ago
parent
commit
3f52232228
36 changed files with 580 additions and 865 deletions
  1. 5 4
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/ExpressionCode.xtend
  2. 14 14
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/types/CTypeSystemAccess.xtend
  3. 11 10
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/ExpressionCode.xtend
  4. 16 16
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/ExpressionCode.xtend
  5. 23 15
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend
  6. 7 6
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/StatemachineInterface.xtend
  7. 14 14
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/types/JavaTypeSystemAccess.xtend
  8. 13 12
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/types/OldJavaTypeSystemAccess.xtend
  9. 9 13
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend
  10. 10 11
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequencerModule.java
  11. 0 1
      plugins/org.yakindu.sct.model.stext/.classpath
  12. 1 1
      plugins/org.yakindu.sct.model.stext/META-INF/MANIFEST.MF
  13. 1 1
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/SText.xtext
  14. 10 7
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/STextRuntimeModule.java
  15. 96 0
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/inferrer/STextTypeInferrer.java
  16. 1 1
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextGlobalScopeProvider.java
  17. 15 21
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java
  18. 0 34
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/types/ISTextTypeInferrer.java
  19. 0 256
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/types/STextDefaultTypeInferrer.xtend
  20. 33 63
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java
  21. 6 6
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SimulationModule.java
  22. 39 36
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.xtend
  23. 13 13
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend
  24. 1 2
      plugins/org.yakindu.sct.simulation.core/model/sruntime.ecore
  25. 10 3
      plugins/org.yakindu.sct.simulation.core/model/sruntime.genmodel
  26. 1 2
      plugins/org.yakindu.sct.simulation.core/plugin.xml
  27. 9 10
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/ExecutionSlot.java
  28. 54 86
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/SRuntimePackage.java
  29. 44 38
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ExecutionContextImpl.java
  30. 43 35
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ExecutionSlotImpl.java
  31. 1 27
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimeFactoryImpl.java
  32. 9 26
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimePackageImpl.java
  33. 1 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/EnumerationEditingSupport.java
  34. 49 73
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/TypeInferrerTest.java
  35. 14 0
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/util/STextRuntimeTestModule.java
  36. 7 7
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/STextInterpreterTest.java

+ 5 - 4
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/ExpressionCode.xtend

@@ -37,7 +37,7 @@ import org.yakindu.base.expressions.expressions.RealLiteral
 import org.yakindu.base.expressions.expressions.ShiftExpression
 import org.yakindu.base.expressions.expressions.StringLiteral
 import org.yakindu.base.expressions.expressions.TypeCastExpression
-import org.yakindu.base.types.ITypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.model.sexec.naming.INamingService
 import org.yakindu.sct.model.sgraph.Event
@@ -46,14 +46,15 @@ import org.yakindu.sct.model.stext.stext.EventRaisingExpression
 import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
 import org.yakindu.sct.model.stext.stext.OperationDefinition
 import org.yakindu.sct.model.stext.stext.VariableDefinition
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
 
 class ExpressionCode {
 
 	@Inject extension Naming
 	@Inject extension Navigation
 	@Inject extension ITypeSystem
-	@Inject extension ISTextTypeInferrer
+	@Inject extension ITypeSystemInferrer
 	@Inject extension INamingService
 	@Inject extension ICodegenTypeSystemAccess
 
@@ -116,7 +117,7 @@ class ExpressionCode {
 	def dispatch CharSequence code(LogicalNotExpression it) '''! «operand.code»'''
 
 	def dispatch CharSequence code(LogicalRelationExpression it) '''
-	«IF leftOperand.inferType.type.stringType»
+	«IF isSame(leftOperand.inferType, getType(DefaultTypeSystem.STRING))»
 		(strcmp(«leftOperand.code», «rightOperand.code») «operator.literal» 0)
 	«ELSE»«leftOperand.code» «operator.literal» «rightOperand.code»«ENDIF»'''
 

+ 14 - 14
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/types/CTypeSystemAccess.xtend

@@ -8,16 +8,16 @@
  * Contributors:
  *     committers of YAKINDU - initial API and implementation
  */
-package org.yakindu.sct.generator.c.types
-
-import com.google.inject.Inject
-import org.yakindu.base.types.ITypeSystem
-import org.yakindu.base.types.Type
-import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
-
+package org.yakindu.sct.generator.c.types
+
+import com.google.inject.Inject
+import org.yakindu.base.types.Type
+import org.yakindu.base.types.typesystem.ITypeSystem
+import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
+import static org.yakindu.base.types.typesystem.DefaultTypeSystem.*
+
 /**
  * @author andreas muelder
- * @author Alexander Nyßen - Adopted to type system changes
  */
 class CTypeSystemAccess implements ICodegenTypeSystemAccess {
 
@@ -25,12 +25,12 @@ class CTypeSystemAccess implements ICodegenTypeSystemAccess {
 	extension ITypeSystem ts
 
 	override getTargetLanguageName(Type type) {
-		switch (type) {
-			case type == null || isVoidType(type): 'void'
-			case isIntegerType(type): 'sc_integer'
-			case isRealType(type): 'sc_real'
-			case isBooleanType(type): 'sc_boolean'
-			case isStringType(type): 'sc_string'
+		switch (type) {
+			case type == null || ts.isSame(type, getType(VOID)) : 'void'
+			case ts.isSame(type, getType(INTEGER)): 'sc_integer'
+			case ts.isSame(type, getType(REAL)): 'sc_real'
+			case ts.isSame(type, getType(BOOLEAN)): 'sc_boolean'
+			case ts.isSame(type, getType(STRING)): 'sc_string'
 		}
 	}
 

+ 11 - 10
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/ExpressionCode.xtend

@@ -27,7 +27,9 @@ import org.yakindu.base.expressions.expressions.RealLiteral
 import org.yakindu.base.expressions.expressions.ShiftExpression
 import org.yakindu.base.expressions.expressions.StringLiteral
 import org.yakindu.base.expressions.expressions.TypeCastExpression
-import org.yakindu.base.types.ITypeSystem
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.model.sexec.naming.INamingService
 import org.yakindu.sct.model.sgraph.Event
@@ -36,17 +38,16 @@ import org.yakindu.sct.model.stext.stext.EventRaisingExpression
 import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
 import org.yakindu.sct.model.stext.stext.OperationDefinition
 import org.yakindu.sct.model.stext.stext.VariableDefinition
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer
 
 class ExpressionCode {
 
 	@Inject extension Naming
 	@Inject extension Navigation
 	@Inject extension ITypeSystem
-	@Inject extension ISTextTypeInferrer
+	@Inject extension ITypeSystemInferrer
 	@Inject extension INamingService
 	@Inject extension ICodegenTypeSystemAccess
-	
+
 	/* Refering to declared elements */
 	def dispatch CharSequence code(ElementReferenceExpression it) {
 		it.code(it.definition)
@@ -70,9 +71,9 @@ class ExpressionCode {
 
 	/* HANDLING LITERALS */
 	def dispatch CharSequence code(Literal it) '''#error unknown literal type «getClass().name» '''
-	
+
 	def dispatch CharSequence code(NullLiteral it) '''«Naming::NULL_STRING»'''
-	
+
 	def dispatch CharSequence code(StringLiteral it) '''"«value.escaped»"'''
 
 	def String escaped(String it) {
@@ -100,7 +101,7 @@ class ExpressionCode {
 
 	/* Logical Expressions */
 	def dispatch CharSequence code(LogicalOrExpression it) '''«leftOperand.code» || «rightOperand.code»'''
-	
+
 	def dispatch CharSequence code(ConditionalExpression it) '''«condition.code» ? «trueCase.code» : «falseCase.code»'''
 
 	def dispatch CharSequence code(LogicalAndExpression it) '''«leftOperand.code» && «rightOperand.code»'''
@@ -108,7 +109,7 @@ class ExpressionCode {
 	def dispatch CharSequence code(LogicalNotExpression it) '''! «operand.code»'''
 
 	def dispatch CharSequence code(LogicalRelationExpression it) '''
-	«IF leftOperand.inferType.type.stringType»
+	«IF isSame(leftOperand.inferType, getType(DefaultTypeSystem.STRING))»
 		(strcmp(«leftOperand.code», «rightOperand.code») «operator.literal» 0)
 	«ELSE»«leftOperand.code» «operator.literal» «rightOperand.code»«ENDIF»'''
 
@@ -136,7 +137,7 @@ class ExpressionCode {
 	def dispatch CharSequence code(ActiveStateReferenceExpression it) '''«flow.activeFctID»(«value.shortName»)'''
 
 	def dispatch CharSequence code(ParenthesizedExpression it) '''(«expression.code»)'''
-	
+
 	def dispatch CharSequence code(TypeCastExpression it) '''((«type.getTargetLanguageName») «operand.code»)'''
-	
+
 }

+ 16 - 16
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/ExpressionCode.xtend

@@ -10,6 +10,7 @@ import org.yakindu.base.expressions.expressions.BitwiseAndExpression
 import org.yakindu.base.expressions.expressions.BitwiseOrExpression
 import org.yakindu.base.expressions.expressions.BitwiseXorExpression
 import org.yakindu.base.expressions.expressions.BoolLiteral
+import org.yakindu.base.expressions.expressions.ConditionalExpression
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression
 import org.yakindu.base.expressions.expressions.FeatureCall
 import org.yakindu.base.expressions.expressions.HexLiteral
@@ -19,6 +20,7 @@ import org.yakindu.base.expressions.expressions.LogicalNotExpression
 import org.yakindu.base.expressions.expressions.LogicalOrExpression
 import org.yakindu.base.expressions.expressions.LogicalRelationExpression
 import org.yakindu.base.expressions.expressions.MultiplicativeOperator
+import org.yakindu.base.expressions.expressions.NullLiteral
 import org.yakindu.base.expressions.expressions.NumericalAddSubtractExpression
 import org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpression
 import org.yakindu.base.expressions.expressions.NumericalUnaryExpression
@@ -29,9 +31,13 @@ import org.yakindu.base.expressions.expressions.RelationalOperator
 import org.yakindu.base.expressions.expressions.ShiftExpression
 import org.yakindu.base.expressions.expressions.ShiftOperator
 import org.yakindu.base.expressions.expressions.StringLiteral
+import org.yakindu.base.expressions.expressions.TypeCastExpression
 import org.yakindu.base.expressions.expressions.UnaryOperator
-import org.yakindu.base.types.ITypeSystem
 import org.yakindu.base.types.Operation
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
+import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.model.sexec.TimeEvent
 import org.yakindu.sct.model.sgraph.Declaration
 import org.yakindu.sct.model.sgraph.Event
@@ -40,18 +46,13 @@ import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression
 import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
 import org.yakindu.sct.model.stext.stext.OperationDefinition
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer
-import org.yakindu.base.expressions.expressions.NullLiteral
-import org.yakindu.base.expressions.expressions.ConditionalExpression
-import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
-import org.yakindu.base.expressions.expressions.TypeCastExpression
 
 class ExpressionCode {
 
 	@Inject extension Naming
 	@Inject extension Navigation
 	@Inject extension ITypeSystem
-	@Inject extension ISTextTypeInferrer
+	@Inject extension ITypeSystemInferrer
 	@Inject extension ICodegenTypeSystemAccess
 
 	private var List<TimeEvent> timeEvents;
@@ -101,7 +102,7 @@ class ExpressionCode {
 	def dispatch String code(RealLiteral expression) {
 		expression.value.toString();
 	}
-	
+
 	def dispatch String code(NullLiteral expression) {
 		'null'
 	}
@@ -118,7 +119,7 @@ class ExpressionCode {
 	def dispatch String code(LogicalOrExpression expression) {
 		expression.leftOperand.code + " || " + expression.rightOperand.code
 	}
-	
+
 	def dispatch String code(ConditionalExpression expression) {
 		expression.condition.code + ' ? ' + expression.trueCase.code + ' : ' + expression.falseCase.code
 	}
@@ -132,7 +133,7 @@ class ExpressionCode {
 	}
 
 	def dispatch String code(LogicalRelationExpression expression) {
-		if (expression.leftOperand.inferType.type.stringType) {
+		if (isSame(expression.leftOperand.inferType, getType(DefaultTypeSystem.STRING))){
 			expression.logicalString
 		} else
 			expression.leftOperand.code + expression.operator.code + expression.rightOperand.code;
@@ -239,10 +240,10 @@ class ExpressionCode {
 	def dispatch String code(TimeEvent it) {
 		"timeEvents[" + getTimeEvents.indexOf(it) + "]"
 	}
-	
-	def dispatch String code(TypeCastExpression it){
-		 '''((«type.getTargetLanguageName») «operand.code»)'''
-	}	
+
+	def dispatch String code(TypeCastExpression it) {
+		'''((«type.getTargetLanguageName») «operand.code»)'''
+	}
 
 	def dispatch String getContext(Variable it) {
 		if (scope != null) {
@@ -268,6 +269,5 @@ class ExpressionCode {
 	def dispatch String getContext(EObject it) {
 		return "//ERROR: No context for " + it
 	}
-	
-	
+
 }

+ 23 - 15
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend

@@ -12,7 +12,7 @@ package org.yakindu.sct.generator.java
 import com.google.inject.Inject
 import java.util.List
 import org.eclipse.xtext.generator.IFileSystemAccess
-import org.yakindu.base.types.ITypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.model.sexec.Check
 import org.yakindu.sct.model.sexec.ExecutionFlow
@@ -22,6 +22,7 @@ import org.yakindu.sct.model.stext.stext.Direction
 import org.yakindu.sct.model.stext.stext.EventDefinition
 import org.yakindu.sct.model.stext.stext.InterfaceScope
 import org.yakindu.sct.model.stext.stext.VariableDefinition
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
 
 class Statemachine {
 	
@@ -46,10 +47,12 @@ class Statemachine {
 		«flow.createImports(entry)»
 		
 		public class «flow.statemachineClassName» implements «flow.statemachineInterfaceName» {
+			«flow.createStaticDeclarations(entry)»
 			
+			«flow.createStaticInitializer(entry)»
+
 			«flow.createFieldDeclarations(entry)»
 		
-			«flow.createStaticInitializer(entry)»
 				
 			«flow.createConstructor»
 			
@@ -93,7 +96,7 @@ class Statemachine {
 		«FOR event : flow.internalScopeEvents»
 		private boolean «event.symbol»;
 		
-		«IF event.type != null && !event.type.voidType»
+		«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 			private «event.type.targetLanguageName» «event.valueIdentifier»;
 		«ENDIF»
 		«ENDFOR»
@@ -115,9 +118,7 @@ class Statemachine {
 		};
 		
 		«FOR variable : flow.internalScopeVariables»
-			«IF variable.const»
-				«variable.constantFieldDeclaration»
-			«ELSE»
+			«IF !variable.const»
 				«variable.writeableFieldDeclaration»
 			«ENDIF»
 		«ENDFOR»
@@ -140,6 +141,15 @@ class Statemachine {
 		«ENDFOR»
 	'''
 	
+	def createStaticDeclarations(ExecutionFlow flow, GeneratorEntry entry){
+		var constants = flow.scopes.map[declarations].flatten.filter(VariableDefinition).filter[const]
+		'''
+			«FOR constant : constants»
+				«constant.constantFieldDeclaration()»
+			«ENDFOR»
+		'''
+	}
+	
 	def private createStaticInitializer(ExecutionFlow flow, GeneratorEntry entry){
 		if(flow.staticInitSequence == null) return null
 		'''
@@ -303,12 +313,12 @@ class Statemachine {
 			
 			private boolean «event.symbol»;
 			
-			«IF event.type != null && !event.type.voidType»
+			«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 				private «event.type.targetLanguageName» «event.valueIdentifier»;
 			«ENDIF»
 			
 			«IF event.direction == Direction::IN»
-				«IF event.type != null && !event.type.voidType»
+				«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 					public void raise«event.name.asName»(«event.type.targetLanguageName» value) {
 						«event.symbol» = true;
 						«event.valueIdentifier» = value;
@@ -333,7 +343,7 @@ class Statemachine {
 					return «event.symbol»;
 				}
 				
-				«IF event.type != null && !event.type.voidType»
+				«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 					private void raise«event.name.asName»(«event.type.targetLanguageName» value) {
 						«event.symbol» = true;
 						«event.valueIdentifier» = value;
@@ -363,9 +373,7 @@ class Statemachine {
 		
 		«FOR variable : scope.variableDefinitions»
 				
-				«IF variable.const»
-					«variable.constantFieldDeclaration»
-				«ELSE»
+				«IF !variable.const»
 					«variable.writeableFieldDeclaration»
 				«ENDIF»
 				«IF!variable.const»
@@ -411,7 +419,7 @@ class Statemachine {
 	
 	def private internalScopeFunctions (ExecutionFlow flow) '''
 		«FOR event : flow.internalScopeEvents»
-			«IF event.type != null && !event.type.voidType»
+			«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 				private void raise«event.name.asEscapedName»(«event.type.targetLanguageName» value) {
 					«event.valueIdentifier» = value;
 					«event.symbol» = true;
@@ -445,7 +453,7 @@ class Statemachine {
 			«var InterfaceScope scope = flow.defaultScope»
 			«FOR event : scope.eventDefinitions»
 				«IF event.direction == Direction::IN»
-					«IF event.type != null && !event.type.voidType»
+					«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 					public void raise«event.name.asName»(«event.type.targetLanguageName» value) {
 						«scope.interfaceName.asEscapedIdentifier».raise«event.name.asName»(value);
 					}
@@ -459,7 +467,7 @@ class Statemachine {
 					public boolean isRaised«event.name.asName»() {
 						return «scope.interfaceName.asEscapedIdentifier».isRaised«event.name.asName»();
 					}
-					«IF event.type != null && !event.type.voidType»
+					«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 						public «event.type.targetLanguageName» get«event.name.asName»Value() {
 							return «scope.interfaceName.asEscapedIdentifier».get«event.name.asName»Value();
 						}

+ 7 - 6
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/StatemachineInterface.xtend

@@ -11,8 +11,9 @@ package org.yakindu.sct.generator.java
 
 import com.google.inject.Inject
 import org.eclipse.xtext.generator.IFileSystemAccess
-import org.yakindu.base.types.ITypeSystem
 import org.yakindu.base.types.Parameter
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.model.sexec.ExecutionFlow
 import org.yakindu.sct.model.sgen.GeneratorEntry
@@ -96,14 +97,14 @@ class StatemachineInterface {
 				«scope.eventAccessors»
 				«scope.variableAccessors»
 				«IF entry.createInterfaceObserver && scope.hasOutgoingEvents»
-					public List<«scope.getInterfaceListenerName()»> getListeners();
+				public List<«scope.getInterfaceListenerName()»> getListeners();
 				«ENDIF»
 			
 					«IF scope.hasOperations()»
 						public void set«scope.getInterfaceOperationCallbackName()»(«scope.getInterfaceOperationCallbackName()» operationCallback);
 					«ENDIF»
 				}
-			'''
+		'''
 	}
 
 	def private createListenerInterface(InterfaceScope scope, GeneratorEntry entry) {
@@ -113,7 +114,7 @@ class StatemachineInterface {
 				public interface «scope.getInterfaceListenerName()» {
 					«FOR event : scope.eventDefinitions»
 						«IF event.direction == Direction::OUT»
-							«IF event.type != null && !event.type.voidType»
+							«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 								public void on«event.name.toFirstUpper()»Raised(«event.type.targetLanguageName» value);
 							«ELSE»
 								public void on«event.name.toFirstUpper()»Raised();
@@ -143,7 +144,7 @@ class StatemachineInterface {
 			«FOR event : scope.eventDefinitions»
 				«IF event.direction == Direction::IN»
 					««« IMPORTANT: An event not specifying a type is regarded to have a void type
-				«IF event.type != null && !event.type.voidType»
+				«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 						public void raise«event.name.asName»(«event.type.targetLanguageName» value);
 					«ELSE»
 						public void raise«event.name.asName»();
@@ -151,7 +152,7 @@ class StatemachineInterface {
 				«ELSEIF event.direction == Direction::OUT»
 					public boolean isRaised«event.name.asName»();
 					««« IMPORTANT: An event not specifying a type is regarded to have a void type
-				«IF event.type != null && !event.type.voidType»
+				«IF event.type != null && !isSame(event.type, getType(DefaultTypeSystem.VOID))»
 						public «event.type.targetLanguageName» get«event.name.asName»Value();
 					«ENDIF»	
 				«ENDIF»

+ 14 - 14
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/types/JavaTypeSystemAccess.xtend

@@ -8,16 +8,17 @@
  * Contributors:
  *     committers of YAKINDU - initial API and implementation
  */
-package org.yakindu.sct.generator.java.types
-
-import com.google.inject.Inject
-import org.yakindu.base.types.ITypeSystem
-import org.yakindu.base.types.Type
-import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
-
+package org.yakindu.sct.generator.java.types
+
+import com.google.inject.Inject
+import org.yakindu.base.types.Type
+import org.yakindu.base.types.typesystem.ITypeSystem
+import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
+
+import static org.yakindu.base.types.typesystem.DefaultTypeSystem.*
+
 /**
  * @author andreas muelder
- * @author Alexander Nyßen - Adopted to type system changes
  */
 class JavaTypeSystemAccess implements ICodegenTypeSystemAccess {
 
@@ -26,13 +27,12 @@ class JavaTypeSystemAccess implements ICodegenTypeSystemAccess {
 
 	override String getTargetLanguageName(Type type) {
 		switch (type) {
-			case type == null || isVoidType(type): "void"
-			case isRealType(type): "double"
-			case isIntegerType(type): "long"
-			case isBooleanType(type): "boolean"
-			case isStringType(type): "String"
+			case type == null || ts.isSame(type, getType(VOID)) : 'void'
+			case ts.isSame(type, getType(REAL)): "double"
+			case ts.isSame(type, getType(INTEGER)): "long"
+			case ts.isSame(type, getType(BOOLEAN)): "boolean"
+			case ts.isSame(type, getType(STRING)): "String"
 			default: "//" + this
 		};
 	}
-
 }

+ 13 - 12
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/types/OldJavaTypeSystemAccess.xtend

@@ -8,13 +8,14 @@
  * Contributors:
  *     committers of YAKINDU - initial API and implementation
  */
-package org.yakindu.sct.generator.java.types
-
-import com.google.inject.Inject
-import org.yakindu.base.types.ITypeSystem
-import org.yakindu.base.types.Type
-import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
-
+package org.yakindu.sct.generator.java.types
+
+import com.google.inject.Inject
+import org.yakindu.base.types.Type
+import org.yakindu.base.types.typesystem.ITypeSystem
+import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
+import static org.yakindu.base.types.typesystem.DefaultTypeSystem.*
+
 /**
  * @author andreas muelder
  * @author Alexander Nyßen - Adopted to type system changes
@@ -26,11 +27,11 @@ class OldJavaTypeSystemAccess implements ICodegenTypeSystemAccess {
 
 	override String getTargetLanguageName(Type type) {
 		switch (type) {
-			case type == null || isVoidType(type): "void"
-			case isRealType(type): "double"
-			case isIntegerType(type): "int"
-			case isBooleanType(type): "boolean"
-			case isStringType(type): "String"
+			case type == null || ts.isSame(type, getType(VOID)) : 'void'
+			case ts.isSame(type, getType(REAL)): "double"
+			case ts.isSame(type, getType(INTEGER)): "int"
+			case ts.isSame(type, getType(BOOLEAN)): "boolean"
+			case ts.isSame(type, getType(STRING)): "String"
 			default: "//" + this
 		};
 	}

+ 9 - 13
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend

@@ -13,7 +13,8 @@ import org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpressio
 import org.yakindu.base.expressions.expressions.PrimitiveValueExpression
 import org.yakindu.base.expressions.expressions.RealLiteral
 import org.yakindu.base.expressions.expressions.StringLiteral
-import org.yakindu.base.types.ITypeSystem
+import org.yakindu.base.types.interpreter.ITypeSystemInterpreter
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.model.sexec.ExecutionFlow
 import org.yakindu.sct.model.sexec.ExecutionRegion
 import org.yakindu.sct.model.sexec.ExecutionState
@@ -39,7 +40,8 @@ class SequenceBuilder {
 	@Inject extension SexecExtensions sexec
 	@Inject extension SexecElementMapping mapping
 	@Inject extension TraceExtensions trace
-
+	
+	@Inject extension ITypeSystemInterpreter
 	@Inject extension ITypeSystem ts
 
 	@Inject @Named("ADD_TRACES")
@@ -492,13 +494,7 @@ class SequenceBuilder {
 		if (vd.initialValue != null) {
 			return vd.initialValue
 		} else {
-			switch (vd) {
-				case isBooleanType(vd.type): false.buildValue
-				case isIntegerType(vd.type): 0.buildValue
-				case isRealType(vd.type): buildValue(0.0d as double)
-				case isStringType(vd.type): "".buildValue
-				default: null
-			}
+			return vd.type.defaultValue.buildValue
 		}
 	}
 
@@ -556,7 +552,7 @@ class SequenceBuilder {
 		div
 	}
 
-	def Expression buildValue(boolean b) {
+	def dispatch Expression buildValue(boolean b) {
 		val PrimitiveValueExpression pve = factory.createPrimitiveValueExpression
 		val BoolLiteral lit = factory.createBoolLiteral
 		lit.value = b
@@ -565,7 +561,7 @@ class SequenceBuilder {
 		pve
 	}
 
-	def Expression buildValue(int i) {
+	def dispatch Expression buildValue(int i) {
 		val PrimitiveValueExpression pve = factory.createPrimitiveValueExpression
 		val IntLiteral lit = factory.createIntLiteral
 		lit.value = i
@@ -574,7 +570,7 @@ class SequenceBuilder {
 		pve
 	}
 
-	def Expression buildValue(double d) {
+	def dispatch Expression buildValue(double d) {
 		val PrimitiveValueExpression pve = factory.createPrimitiveValueExpression
 		val RealLiteral lit = factory.createRealLiteral
 		lit.value = d
@@ -583,7 +579,7 @@ class SequenceBuilder {
 		pve
 	}
 
-	def Expression buildValue(String i) {
+	def dispatch Expression buildValue(String i) {
 		val PrimitiveValueExpression pve = factory.createPrimitiveValueExpression
 		val StringLiteral lit = factory.createStringLiteral
 		lit.value = i

+ 10 - 11
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequencerModule.java

@@ -4,12 +4,12 @@ import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.resource.IResourceDescriptions;
 import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
 import org.eclipse.xtext.service.AbstractGenericModule;
-import org.yakindu.base.types.ITypeSystem;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sexec.naming.DefaultNamingService;
 import org.yakindu.sct.model.sexec.naming.INamingService;
 import org.yakindu.sct.model.sgraph.naming.SGraphNameProvider;
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
-import org.yakindu.sct.model.stext.types.STextDefaultTypeInferrer;
+import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 
 import com.google.inject.Binder;
 import com.google.inject.name.Names;
@@ -27,14 +27,13 @@ public class SequencerModule extends AbstractGenericModule {
 
 	public void configure(Binder binder) {
 		super.configure(binder);
-		binder.bind(Boolean.class).annotatedWith(Names.named(ADD_TRACES))
-				.toInstance(Boolean.FALSE);
+		binder.bind(Boolean.class).annotatedWith(Names.named(ADD_TRACES)).toInstance(Boolean.FALSE);
 	}
 
-	public Class<? extends IModelSequencer> bindIModelSequencer(){
+	public Class<? extends IModelSequencer> bindIModelSequencer() {
 		return ModelSequencer.class;
 	}
-	
+
 	public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
 		return SGraphNameProvider.class;
 	}
@@ -43,14 +42,14 @@ public class SequencerModule extends AbstractGenericModule {
 		return ITypeSystem.class;
 	}
 
-	public Class<? extends ISTextTypeInferrer> bindISTextTypeInferrer() {
-		return STextDefaultTypeInferrer.class;
+	public Class<? extends ITypeSystemInferrer> bindISTextTypeInferrer() {
+		return STextTypeInferrer.class;
 	}
-	
+
 	public Class<? extends INamingService> bindINamingService() {
 		return DefaultNamingService.class;
 	}
-	
+
 	public Class<? extends IResourceDescriptions> bindIResourceDescriptions() {
 		return ResourceSetBasedResourceDescriptions.class;
 	}

+ 0 - 1
plugins/org.yakindu.sct.model.stext/.classpath

@@ -2,7 +2,6 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="src-gen"/>
-	<classpathentry kind="src" path="xtend-gen"/>
 	<classpathentry kind="src" path="model"/>
 	<classpathentry kind="src" path="emf-gen"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>

+ 1 - 1
plugins/org.yakindu.sct.model.stext/META-INF/MANIFEST.MF

@@ -32,6 +32,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Export-Package: org.yakindu.sct.model.stext,
  org.yakindu.sct.model.stext.conversion,
  org.yakindu.sct.model.stext.formatting,
+ org.yakindu.sct.model.stext.inferrer,
  org.yakindu.sct.model.stext.naming,
  org.yakindu.sct.model.stext.parseTreeConstruction,
  org.yakindu.sct.model.stext.parser.antlr,
@@ -41,7 +42,6 @@ Export-Package: org.yakindu.sct.model.stext,
  org.yakindu.sct.model.stext.stext,
  org.yakindu.sct.model.stext.stext.impl,
  org.yakindu.sct.model.stext.stext.util,
- org.yakindu.sct.model.stext.types,
  org.yakindu.sct.model.stext.util,
  org.yakindu.sct.model.stext.validation
 Bundle-ClassPath: .

+ 1 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/SText.xtext

@@ -93,7 +93,7 @@ VariableFeature returns types::Property:
 	VariableDefinition;
 
 VariableDefinition:
-	{VariableDefinition} 'var' ((readonly?='readonly')? & (external?='external')?) name=XID ':' type=[types::Type|FQN]
+	{VariableDefinition} (const?='const'|'var') ((readonly?='readonly')? & (external?='external')?) name=XID ':' type=[types::Type|FQN]
 	(('<' (typeArguments+=[types::Type|QID]) (',' typeArguments+=[types::Type|QID])* '>'))?
 	('=' initialValue=Expression)?; /* ---- operation definition ---- */ OperationDeclaration returns
 sgraph::Declaration:

+ 10 - 7
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/STextRuntimeModule.java

@@ -14,11 +14,13 @@ import org.eclipse.xtext.Constants;
 import org.eclipse.xtext.linking.ILinker;
 import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
-import org.yakindu.base.types.DefaultTypeSystem;
-import org.yakindu.base.types.ITypeSystem;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.typesystem.DefaultTypeSystem;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.resource.SCTLinker;
 import org.yakindu.sct.model.sgraph.resource.provider.SCTResourceDescriptionStrategy;
 import org.yakindu.sct.model.stext.conversion.StextValueConverterService;
+import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 import org.yakindu.sct.model.stext.naming.StextNameProvider;
 import org.yakindu.sct.model.stext.scoping.STextGlobalScopeProvider;
 
@@ -32,8 +34,7 @@ import com.google.inject.name.Names;
  * @author andreas muelder
  * @author axel terfloth
  */
-public class STextRuntimeModule extends
-		org.yakindu.sct.model.stext.AbstractSTextRuntimeModule {
+public class STextRuntimeModule extends org.yakindu.sct.model.stext.AbstractSTextRuntimeModule {
 
 	public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
 		return STextGlobalScopeProvider.class;
@@ -58,14 +59,16 @@ public class STextRuntimeModule extends
 		return DefaultTypeSystem.class;
 	}
 
+	public Class<? extends ITypeSystemInferrer> bindITypeSystemInferrer() {
+		return STextTypeInferrer.class;
+	}
+
 	public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
 		return SCTResourceDescriptionStrategy.class;
 	}
 
 	public void configureFileExtensions(Binder binder) {
-		binder.bind(String.class)
-				.annotatedWith(Names.named(Constants.FILE_EXTENSIONS))
-				.toInstance("stext,sct");
+		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("stext,sct");
 	}
 
 }

+ 96 - 0
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/inferrer/STextTypeInferrer.java

@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.stext.inferrer;
+
+import static org.yakindu.base.types.typesystem.DefaultTypeSystem.BOOLEAN;
+import static org.yakindu.base.types.typesystem.DefaultTypeSystem.VOID;
+
+import org.eclipse.emf.ecore.EObject;
+import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
+import org.yakindu.base.expressions.expressions.Expression;
+import org.yakindu.base.expressions.expressions.FeatureCall;
+import org.yakindu.base.expressions.inferrer.ExpressionsTypeInferrer;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
+import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class STextTypeInferrer extends ExpressionsTypeInferrer {
+
+	public static final String VARIABLE_DEFINITION = "Cannot assign a value of type %s to a variable of type %s.";
+	public static final String EVENT_DEFINITION = "Cannot assign a value of type %s to an event of type %s.";
+
+	public Object infer(VariableDefinition e) {
+		Type type = e.getType();
+		if (e.getInitialValue() == null)
+			return inferType(type);
+		Type type2 = inferType(e.getInitialValue());
+		assertCompatibleType(type, type2, String.format(VARIABLE_DEFINITION, type2, type));
+		return inferType(type);
+	}
+
+	public Object infer(EventDefinition e) {
+		// if an event is used within an expression, the type is boolean and the
+		// value indicates if the event is raised or not
+		return getType(BOOLEAN);
+	}
+
+	public Object infer(EventValueReferenceExpression e) {
+		EventDefinition definition = deresolve(e.getValue());
+		if(definition != null)
+			return inferType(definition.getType());
+		return inferType(e.getValue());
+	}
+
+	public Object infer(OperationDefinition e) {
+		return inferType(e.getType());
+	}
+
+	public Object infer(EventRaisingExpression e) {
+		if (e.getValue() == null)
+			return getType(VOID);
+		Type type1 = inferType(deresolve(e.getEvent()).getType());
+		Type type2 = inferType(e.getValue());
+		assertIsSuperType(type1, type2, String.format(EVENT_DEFINITION, type2, type1));
+		return inferType(e.getValue());
+
+	}
+
+	protected EventDefinition deresolve(Expression e) {
+		// TODO This is ugly -> reuse the TypeTrace to determine the context in
+		// infer(EventDefinition)
+		if (e instanceof ElementReferenceExpression) {
+			EObject reference = ((ElementReferenceExpression) e).getReference();
+			if (reference instanceof EventDefinition) {
+				return (EventDefinition) reference;
+			}
+		}
+		if (e instanceof FeatureCall) {
+			EObject reference = ((FeatureCall) e).getFeature();
+			if (reference instanceof EventDefinition) {
+				return (EventDefinition) reference;
+			}
+		}
+		return null;
+	}
+
+	public Object infer(ActiveStateReferenceExpression e) {
+		return getType(BOOLEAN);
+	}
+
+}

+ 1 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextGlobalScopeProvider.java

@@ -19,9 +19,9 @@ import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.scoping.IScope;
 import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider;
 import org.eclipse.xtext.scoping.impl.FilteringScope;
-import org.yakindu.base.types.ITypeSystem;
 import org.yakindu.base.types.ITypeSystemRegistry;
 import org.yakindu.base.types.scope.TypeSystemAwareScope;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 
 import com.google.common.base.Predicate;
 import com.google.inject.Inject;

+ 15 - 21
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -37,8 +37,7 @@ import org.yakindu.base.expressions.expressions.FeatureCall;
 import org.yakindu.base.types.ComplexType;
 import org.yakindu.base.types.EnumerationType;
 import org.yakindu.base.types.Feature;
-import org.yakindu.base.types.ITypeSystem;
-import org.yakindu.base.types.TypeSystemUtils;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.Statechart;
@@ -66,9 +65,6 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 	@Inject
 	ITypeSystem typeSystem;
 
-	@Inject
-	TypeSystemUtils typeSystemUtils;
-
 	private static class ErrorHandlerDelegate<T> implements ErrorHandler<T> {
 
 		private ErrorHandler<T> delegate;
@@ -109,30 +105,29 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 	private ContextPredicateProvider predicateProvider;
 
 	/**
-	 * Scoping for types and taking imported namespaces into account e.g. in variable declarations. 
+	 * Scoping for types and taking imported namespaces into account e.g. in
+	 * variable declarations.
 	 */
 	public IScope scope_TypedElement_type(final EObject context, EReference reference) {
 		Statechart statechart = getStatechart(context);
 		EList<Scope> scopes = statechart.getScopes();
 		IScope scope = retrieveImportScope(context, reference, scopes);
-		
+
 		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
 		return new FilteringScope(scope, predicate);
 	}
-	
+
 	public IScope scope_ElementReferenceExpression_reference(final EObject context, EReference reference) {
 		IScope namdScope = getNamedTopLevelScope(context, reference);
 		IScope unnamedScope = getUnnamedTopLevelScope(context, reference);
-		
-		// XXX: filter on EVENT is too restrictive because also variable definitions should be usable
+
+		// XXX: filter on EVENT is too restrictive because also variable
+		// definitions should be usable
 		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
 		unnamedScope = new FilteringScope(unnamedScope, predicate);
-		
-		// add enum types
-		IScope scope = new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements(), Scopes
-				.scopeFor(typeSystemUtils.getEnumerationTypes(typeSystem)).getAllElements()));
-		
-		return scope;
+
+		return new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements()));
+
 	}
 
 	public IScope scope_FeatureCall_feature(final FeatureCall context, EReference reference) {
@@ -157,7 +152,7 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 
 		if (element instanceof ComplexType) {
-			scope = Scopes.scopeFor(((ComplexType)element).getAllFeatures(), scope);
+			scope = Scopes.scopeFor(((ComplexType) element).getAllFeatures(), scope);
 			scope = new FilteringScope(scope, predicate);
 		}
 
@@ -166,8 +161,8 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 			scope = new FilteringScope(scope, predicate);
 		}
 
-		if (element instanceof Feature && ((Feature)element).getType() instanceof ComplexType) {
-			scope = Scopes.scopeFor(((ComplexType)((Feature)element).getType()).getAllFeatures(), scope);
+		if (element instanceof Feature && ((Feature) element).getType() instanceof ComplexType) {
+			scope = Scopes.scopeFor(((ComplexType) ((Feature) element).getType()).getAllFeatures(), scope);
 			scope = new FilteringScope(scope, predicate);
 		}
 
@@ -249,7 +244,7 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 				scopeCandidates.addAll(scope.getDeclarations());
 			}
 		}
-		
+
 		// Add import scope
 		IScope scope = retrieveImportScope(context, reference, scopes);
 		return Scopes.scopeFor(scopeCandidates, scope);
@@ -287,4 +282,3 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 	}
 }
-

+ 0 - 34
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/types/ISTextTypeInferrer.java

@@ -1,34 +0,0 @@
-/**
- * Copyright (c) 2012 itemis AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- * 	itemis AG - initial API and implementation
- * 
- */
-package org.yakindu.sct.model.stext.types;
-
-import org.yakindu.base.expressions.inferrer.IExpressionsTypeInferrer;
-import org.yakindu.base.types.InferenceResult;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-import com.google.inject.ImplementedBy;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * @author Alexander Nyßen - Adopted to changes in type system
- * 
- */
-@ImplementedBy(STextDefaultTypeInferrer.class)
-public interface ISTextTypeInferrer extends IExpressionsTypeInferrer {
-	
-	InferenceResult inferType(VariableDefinition d);
-	
-	InferenceResult inferType(EventDefinition d);
-	
-}

+ 0 - 256
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/types/STextDefaultTypeInferrer.xtend

@@ -1,256 +0,0 @@
-/**
- * Copyright (c) 2011 itemis AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- * 	itemis AG - initial API and implementation
- *  
- */
-package org.yakindu.sct.model.stext.types
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.core.runtime.IStatus
-import org.yakindu.base.expressions.expressions.AssignmentExpression
-import org.yakindu.base.expressions.expressions.ElementReferenceExpression
-import org.yakindu.base.expressions.expressions.Expression
-import org.yakindu.base.expressions.expressions.FeatureCall
-import org.yakindu.base.expressions.inferrer.DefaultExpressionsTypeInferrer
-import org.yakindu.base.types.Event
-import org.yakindu.base.types.Feature
-import org.yakindu.base.types.ITypeSystem
-import org.yakindu.base.types.ITypeSystem.BinaryOperators
-import org.yakindu.base.types.InferenceIssue
-import org.yakindu.base.types.InferenceResult
-import org.yakindu.base.types.InferredType
-import org.yakindu.base.types.ParameterizedType
-import org.yakindu.base.types.Type
-import org.yakindu.base.types.TypeParameter
-import org.yakindu.base.types.TypedElement
-import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
-import org.yakindu.sct.model.stext.stext.EventDefinition
-import org.yakindu.sct.model.stext.stext.EventRaisingExpression
-import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
-import org.yakindu.sct.model.stext.stext.InterfaceScope
-import org.yakindu.sct.model.stext.stext.InternalScope
-import org.yakindu.sct.model.stext.stext.OperationDefinition
-import org.yakindu.sct.model.stext.stext.VariableDefinition
-
-/**
- * 
- * The TypeInferrer checks an expression AST for type conformance
- * 
- * @author andreas muelder - Initial contribution and API
- * @author Alexander Nyßen - Complete revision of API
- *  
- */
-@Singleton
-class STextDefaultTypeInferrer extends DefaultExpressionsTypeInferrer implements ISTextTypeInferrer {
-
-	@Inject protected extension ITypeSystem ts
-
-	override inferType(VariableDefinition definition) {
-		if (definition == null) {
-			throw new IllegalArgumentException("Definition may not be null")
-		} else {
-			definition.doInferType
-		}
-	}
-
-	override inferType(EventDefinition definition) {
-		if (definition == null) {
-			throw new IllegalArgumentException("Definition may not be null")
-		} else {
-			definition.doInferType
-		}
-	}
-
-	def dispatch InferenceResult doInferType(VariableDefinition definition) {
-		if (definition.type == null) {
-			return new InferenceResult(null,
-				new InferenceIssue("Could not infer type of variable: " + definition.name, IStatus::ERROR))
-		} else {
-			var varType = new InferenceResult(new InferredType(definition.type))
-			if (definition.initialValue != null) {
-				val valueType = definition.initialValue.doInferType
-				if (valueType.type == null) {
-					return valueType
-				}
-
-				// reuse the assignment logic of the type system
-				val result = inferResult(varType, valueType, BinaryOperators.ASSIGN)
-				if (result.type == null) {
-					return new InferenceResult(null,
-						new InferenceIssue(
-							"Cannot assign a value of type " + valueType.type.type.name + " to a variable of type " +
-								varType.type.type.name + ".", IStatus::ERROR))
-				}
-			}
-			return varType
-		}
-	}
-
-	def dispatch InferenceResult doInferType(EventDefinition definition) {
-		if (definition == null) {
-			throw new IllegalArgumentException("EventDefinition may not be null")
-		}
-		if (definition.type == null) {
-			return new InferenceResult(new InferredType(voidType))
-		}
-		return new InferenceResult(new InferredType(definition.type))
-	}
-
-	def dispatch InferenceResult doInferType(OperationDefinition definition) {
-		if (definition == null) {
-			throw new IllegalArgumentException("EventDefinition may not be null")
-		}
-		if (definition.type == null) {
-			return new InferenceResult(new InferredType(voidType))
-		}
-		return new InferenceResult(new InferredType(definition.type))
-	}
-
-	def dispatch InferenceResult doInferType(Type type) {
-		return new InferenceResult(new InferredType(type))
-	}
-
-	def dispatch InferenceResult doInferType(InterfaceScope s) {
-
-		// TODO: this could be handled via the type system
-		return new InferenceResult(voidType)
-	}
-
-	def dispatch InferenceResult doInferType(InternalScope s) {
-
-		// TODO: this could be handled via the type system
-		return new InferenceResult(voidType)
-	}
-
-	def dispatch InferenceResult doInferType(Expression e) {
-		println("Unsupported expression type " + e)
-		return new InferenceResult(voidType);
-//		throw new UnsupportedOperationException("Unsupported expression type " + e)
-	}
-
-	def dispatch InferenceResult doInferType(AssignmentExpression expression) {
-		return inferResult(expression.varRef.doInferType, expression.expression.doInferType,
-			getTypeSystemOperator(expression.operator))
-	}
-
-	def dispatch InferenceResult doInferType(EventRaisingExpression eventRaising) {
-		val eventType = eventRaising.event.doInferType
-		if (eventType.type == null) {
-			return eventType
-		} else {
-			if (eventRaising.value == null) {
-				if (!eventType.type.voidType) {
-					return new InferenceResult(null,
-						new InferenceIssue(
-							"Need to assign a value to an event of type " + eventType.type.type.name + ".",
-							IStatus::ERROR))
-				}
-				return eventType
-			} else {
-				val valueType = eventRaising.value.doInferType
-				if (valueType.type == null) {
-					return valueType
-				}
-
-				// reuse the assignment logic of the type system
-				val result = inferResult(eventType, valueType, BinaryOperators.ASSIGN)
-				if (result.type == null) {
-					return new InferenceResult(null,
-						new InferenceIssue(
-							"Cannot assign a value of type " + valueType.type.type.name + " to an event of type " +
-								eventType.type.type.name + ".", IStatus::ERROR))
-				} else {
-					return result
-				}
-			}
-		}
-	}
-
-	def dispatch InferenceResult doInferType(ActiveStateReferenceExpression expression) {
-		return new InferenceResult(getBooleanType)
-	}
-
-	def dispatch InferenceResult doInferType(ElementReferenceExpression expression) {
-		if (expression.reference instanceof EventDefinition && !(expression.eContainer instanceof EventRaisingExpression ||
-			expression.eContainer instanceof EventValueReferenceExpression)) {
-
-			// in case we are not inside an raise or valueOf expression, the event is a shortcut for isRaised(event) and thus, we may return boolean here
-			return new InferenceResult(getBooleanType)
-		} else {
-
-			// inference of the reference type is not context dependent
-			return expression.reference.doInferType
-		}
-	}
-
-	def dispatch InferenceResult doInferType(FeatureCall featureCall) {
-		if (featureCall.feature instanceof Event /*Definition*/ &&
-			!(featureCall.eContainer instanceof EventRaisingExpression) &&
-			!(featureCall.eContainer instanceof EventValueReferenceExpression)) {
-
-			// e1 is a shortcut for isRaised(e1) and thus we have to return boolean here
-			return new InferenceResult(getBooleanType)
-		}
-		if (featureCall.feature instanceof Feature) {
-			val type = (featureCall.feature as Feature).type
-			if (type != null) {
-				if (type instanceof TypeParameter) {
-					val instanceType = getInstanceTypeForTypeParameter(type as TypeParameter, featureCall)
-					if (instanceType != null) {
-						return new InferenceResult(new InferredType(instanceType))
-					}
-				}
-				return new InferenceResult(new InferredType(type))
-			}
-			return new InferenceResult(getVoidType)
-		}
-		return featureCall.feature.doInferType
-	}
-	
-	// TODO: needs to be tested more properly
-	def private Type getInstanceTypeForTypeParameter(TypeParameter type, FeatureCall featureCall) {
-		if (featureCall.owner instanceof FeatureCall) {
-			val current = featureCall.owner as FeatureCall
-			val element = current.feature
-			if (element instanceof TypedElement) {
-				val innerType = getInstanceTypeForTypeParameter(type, element as TypedElement)
-				if (innerType instanceof TypeParameter) {
-					// recursive invocation on outer feature call
-					return getInstanceTypeForTypeParameter(innerType as TypeParameter, current)
-				}
-				else {
-					return innerType
-				}
-			}
-		}
-		else if (featureCall.owner instanceof ElementReferenceExpression) {
-			val element = (featureCall.owner as ElementReferenceExpression).reference
-			if (element instanceof TypedElement) {
-				return getInstanceTypeForTypeParameter(type, element as TypedElement)
-			}
-		}
-	}
-	
-	def private getInstanceTypeForTypeParameter(TypeParameter type, TypedElement instance) {
-		val t = instance.getType
-		if (t instanceof ParameterizedType) {
-			var index = (t as ParameterizedType).parameter.indexOf(type)
-			if (!(index == -1)) {
-				return instance.typeArguments.get(index)
-			}
-		}
-		return null
-	}
-
-	def dispatch InferenceResult doInferType(EventValueReferenceExpression expression) {
-		return doInferType(expression.value)
-	}
-
-}

+ 33 - 63
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -51,12 +51,12 @@ import org.yakindu.base.expressions.expressions.FeatureCall;
 import org.yakindu.base.expressions.validation.ExpressionsJavaValidator;
 import org.yakindu.base.types.Event;
 import org.yakindu.base.types.Feature;
-import org.yakindu.base.types.ITypeSystem;
-import org.yakindu.base.types.InferenceResult;
 import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.Parameter;
 import org.yakindu.base.types.Property;
 import org.yakindu.base.types.TypesPackage;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer.ITypeTraceAcceptor;
 import org.yakindu.sct.model.sgraph.Choice;
 import org.yakindu.sct.model.sgraph.Declaration;
 import org.yakindu.sct.model.sgraph.Entry;
@@ -94,7 +94,6 @@ import org.yakindu.sct.model.stext.stext.ReactionTrigger;
 import org.yakindu.sct.model.stext.stext.StextPackage;
 import org.yakindu.sct.model.stext.stext.TimeEventSpec;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
 
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
@@ -113,12 +112,11 @@ import de.itemis.xtext.utils.jface.viewers.ContextElementAdapter;
  * 
  */
 @ComposedChecks(validators = { SGraphJavaValidator.class, SCTResourceValidator.class, ExpressionsJavaValidator.class })
-public class STextJavaValidator extends AbstractSTextJavaValidator implements STextValidationMessages {
+public class STextJavaValidator extends AbstractSTextJavaValidator implements STextValidationMessages,
+		ITypeTraceAcceptor {
 
 	@Inject
-	private ISTextTypeInferrer typeInferrer;
-	@Inject
-	private ITypeSystem typeSystem;
+	private ITypeSystemInferrer typeInferrer;
 	@Inject
 	private STextGrammarAccess grammarAccess;
 	@Inject
@@ -131,6 +129,34 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 	@Inject
 	private ResourceDescriptionsProvider resourceDescriptionsProvider;
 
+	@Check
+	public void checkExpression(VariableDefinition expression) {
+		typeInferrer.inferType(expression, this);
+	}
+
+	@Check
+	public void checkExpression(TimeEventSpec expression) {
+		typeInferrer.inferType(expression, this);
+	}
+
+	@Check
+	public void checkExpression(Guard expression) {
+		typeInferrer.inferType(expression, this);
+	}
+
+	public void accept(TypeTrace trace) {
+		switch (trace.getSeverity()) {
+		case ERROR:
+			error(trace.getMessage(), null);
+			break;
+		case WARNING:
+			warning(trace.getMessage(), null);
+			break;
+		case INFO:
+			break;
+		}
+	}
+
 	@Check(CheckType.FAST)
 	public void transitionsWithNoTrigger(Transition trans) {
 		if (trans.getSource() instanceof Entry || trans.getSource() instanceof Choice
@@ -416,21 +442,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check(CheckType.FAST)
-	public void checkVariableDefinition(final VariableDefinition definition) {
-		try {
-			InferenceResult result = typeInferrer.inferType(definition);
-			if (result.getType() != null && typeSystem.isVoidType(result.getType())) {
-				error(VARIABLE_VOID_TYPE, null);
-			} else {
-				report(result, null);
-			}
-		} catch (IllegalArgumentException e) {
-			// ignore unknown literals here, as this also happens when a
-			// linking problem occurred, which is handled in other locations
-		}
-	}
-
 	@Check(CheckType.FAST)
 	public void checkOperationArguments_FeatureCall(final FeatureCall call) {
 		if (call.getFeature() instanceof Operation) {
@@ -511,34 +522,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check(CheckType.FAST)
-	public void checkGuard(Guard guard) {
-		try {
-			InferenceResult result = typeInferrer.inferType(guard.getExpression());
-			if (result.getType() == null || !typeSystem.isBooleanType(result.getType())) {
-				error(GUARD_EXPRESSION, StextPackage.Literals.GUARD__EXPRESSION);
-			}
-			report(result, null);
-		} catch (IllegalArgumentException e) {
-			// ignore unknown literals here, as this also happens when a
-			// linking problem occurred, which is handled in other locations
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void checkTimeEventSpecValueExpression(TimeEventSpec spec) {
-		try {
-			InferenceResult result = typeInferrer.inferType(spec.getValue());
-			if (result.getType() == null || !typeSystem.isIntegerType(result.getType())) {
-				error(TIME_EXPRESSION, null);
-			}
-			report(result, StextPackage.Literals.TIME_EVENT_SPEC__VALUE);
-		} catch (IllegalArgumentException e) {
-			// ignore unknown literals here, as this also happens when a
-			// linking problem occurred, which is handled in other locations
-		}
-	}
-
 	@Check(CheckType.FAST)
 	public void checkReactionTrigger(ReactionTrigger reactionTrigger) {
 		for (EventSpec eventSpec : reactionTrigger.getTriggers()) {
@@ -551,19 +534,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check(CheckType.FAST)
-	public void checkReactionEffectActionExpression(ReactionEffect effect) {
-		EList<Expression> actions = effect.getActions();
-		for (Expression expression : actions) {
-			try {
-				report(typeInferrer.inferType(expression), null);
-			} catch (IllegalArgumentException e) {
-				// ignore unknown literals here, as this also happens when a
-				// linking problem occurred, which is handled in other locations
-			}
-		}
-	}
-
 	/**
 	 * Only Expressions that produce an effect should be used as actions.
 	 * 

+ 6 - 6
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SimulationModule.java

@@ -14,14 +14,14 @@ import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.resource.IResourceDescriptions;
 import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
 import org.eclipse.xtext.service.AbstractGenericModule;
-import org.yakindu.base.types.DefaultTypeSystem;
-import org.yakindu.base.types.ITypeSystem;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.typesystem.DefaultTypeSystem;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sexec.transformation.IModelSequencer;
 import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
 import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 import org.yakindu.sct.model.stext.naming.StextNameProvider;
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
-import org.yakindu.sct.model.stext.types.STextDefaultTypeInferrer;
 import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
 import org.yakindu.sct.simulation.core.sexec.container.DefaultExecutionContextInitializer;
 import org.yakindu.sct.simulation.core.sexec.container.DefaultSimulationEngineFactory;
@@ -105,8 +105,8 @@ public class SimulationModule extends AbstractGenericModule {
 		return DefaultTypeSystem.class;
 	}
 
-	public Class<? extends ISTextTypeInferrer> bindISTextTypeInferrer() {
-		return STextDefaultTypeInferrer.class;
+	public Class<? extends ITypeSystemInferrer> bindISTextTypeInferrer() {
+		return STextTypeInferrer.class;
 	}
 	
 	public Class<? extends IResourceDescriptions> bindIResourceDescriptions() {

+ 39 - 36
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.xtend

@@ -8,35 +8,37 @@
  * 	committers of YAKINDU - initial API and implementation
  * 
  */
-package org.yakindu.sct.simulation.core.sexec.container
-
-import com.google.inject.Inject
-import java.util.List
-import org.eclipse.xtext.EcoreUtil2
-import org.eclipse.xtext.naming.IQualifiedNameProvider
-import org.yakindu.base.types.ITypeSystem
-import org.yakindu.base.types.InferredType
-import org.yakindu.base.types.Package
-import org.yakindu.sct.model.sexec.ExecutionFlow
-import org.yakindu.sct.model.sexec.TimeEvent
-import org.yakindu.sct.model.sgraph.Declaration
-import org.yakindu.sct.model.sgraph.ImportDeclaration
-import org.yakindu.sct.model.sgraph.Scope
-import org.yakindu.sct.model.stext.stext.EventDefinition
-import org.yakindu.sct.model.stext.stext.ImportScope
-import org.yakindu.sct.model.stext.stext.InterfaceScope
-import org.yakindu.sct.model.stext.stext.InternalScope
-import org.yakindu.sct.model.stext.stext.OperationDefinition
-import org.yakindu.sct.model.stext.stext.VariableDefinition
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer
-import org.yakindu.sct.simulation.core.sruntime.CompositeSlot
-import org.yakindu.sct.simulation.core.sruntime.EventDirection
-import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
-import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot
-import org.yakindu.sct.simulation.core.sruntime.impl.CompositeSlotImpl
-import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionEventImpl
-import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionVariableImpl
-
+package org.yakindu.sct.simulation.core.sexec.container
+
+import com.google.inject.Inject
+import java.util.List
+import org.eclipse.xtext.EcoreUtil2
+import org.eclipse.xtext.naming.IQualifiedNameProvider
+import org.yakindu.base.types.Package
+import org.yakindu.base.types.Type
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
+import org.yakindu.sct.model.sexec.ExecutionFlow
+import org.yakindu.sct.model.sexec.TimeEvent
+import org.yakindu.sct.model.sgraph.Declaration
+import org.yakindu.sct.model.sgraph.ImportDeclaration
+import org.yakindu.sct.model.sgraph.Scope
+import org.yakindu.sct.model.stext.stext.EventDefinition
+import org.yakindu.sct.model.stext.stext.ImportScope
+import org.yakindu.sct.model.stext.stext.InterfaceScope
+import org.yakindu.sct.model.stext.stext.InternalScope
+import org.yakindu.sct.model.stext.stext.OperationDefinition
+import org.yakindu.sct.model.stext.stext.VariableDefinition
+import org.yakindu.sct.simulation.core.sruntime.CompositeSlot
+import org.yakindu.sct.simulation.core.sruntime.EventDirection
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
+import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot
+import org.yakindu.sct.simulation.core.sruntime.impl.CompositeSlotImpl
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionEventImpl
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionVariableImpl
+import org.yakindu.base.types.interpreter.ITypeSystemInterpreter
+
 /**
  * 
  * @author andreas muelder - Initial contribution and API
@@ -46,7 +48,8 @@ class DefaultExecutionContextInitializer implements IExecutionContextInitializer
 
 	@Inject extension IQualifiedNameProvider
 	@Inject extension ITypeSystem
-	@Inject extension ISTextTypeInferrer
+	@Inject extension ITypeSystemInferrer
+	@Inject extension ITypeSystemInterpreter
 
 	override initialize(ExecutionContext context, ExecutionFlow flow) {
 		flow.scopes.forEach[context.slots += transform]
@@ -112,7 +115,7 @@ class DefaultExecutionContextInitializer implements IExecutionContextInitializer
 	def dispatch ExecutionSlot create new ExecutionVariableImpl() transform(VariableDefinition variable) {
 		it.name = variable.fullyQualifiedName.lastSegment
 		it.fqName = variable.fullyQualifiedName.toString
-		it.type = variable.inferType.type
+		it.type = variable.inferType(null)
 		it.value = it.type.initialValue
 		it.writable = !variable.const
 	}
@@ -120,7 +123,7 @@ class DefaultExecutionContextInitializer implements IExecutionContextInitializer
 	def dispatch ExecutionSlot create new ExecutionEventImpl() transform(EventDefinition event) {
 		it.name = event.fullyQualifiedName.lastSegment
 		it.fqName = event.fullyQualifiedName.toString
-		it.type = event.inferType.type
+		it.type = event.inferType(null)
 		it.value = it.type.initialValue
 		it.direction = EventDirection.get(event.direction.value)
 	}
@@ -128,19 +131,19 @@ class DefaultExecutionContextInitializer implements IExecutionContextInitializer
 	def dispatch ExecutionSlot create new ExecutionVariableImpl() transform(OperationDefinition op) {
 		it.name = op.fullyQualifiedName.lastSegment
 		it.fqName = op.fullyQualifiedName.toString
-		it.type = new InferredType(if(op.type != null) op.type else voidType)
+		it.type = if(op.type != null) op.type else getType(DefaultTypeSystem.VOID)
 		it.value = it.type.initialValue
 	}
 
 	def dispatch ExecutionSlot create new ExecutionEventImpl() transform(TimeEvent event) {
 		it.name = event.fullyQualifiedName.lastSegment
 		it.fqName = event.fullyQualifiedName.toString
-		it.type = new InferredType(integerType)
+		it.type = getType(DefaultTypeSystem.INTEGER)
 		it.value = initialValue(it.type)
 	}
 
-	def Object initialValue(InferredType inferredType) {
-		return inferredType.type.defaultValue
+	def Object initialValue(Type type) {
+		return type.defaultValue
 	}
 	
 }

+ 13 - 13
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -40,17 +40,18 @@ import org.yakindu.base.expressions.expressions.ShiftExpression
 import org.yakindu.base.expressions.expressions.StringLiteral
 import org.yakindu.base.expressions.expressions.TypeCastExpression
 import org.yakindu.base.types.Enumerator
-import org.yakindu.base.types.ITypeSystem
 import org.yakindu.base.types.Operation
 import org.yakindu.base.types.Type
+import org.yakindu.base.types.typesystem.DefaultTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression
 import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
+import org.yakindu.sct.model.stext.stext.OperationDefinition
 import org.yakindu.sct.simulation.core.sruntime.CompositeSlot
 import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable
-import org.yakindu.sct.model.stext.stext.OperationDefinition
 
 /**
  * 
@@ -90,30 +91,30 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	}
 
 	def dispatch Object typeCast(Long value, Type type) {
-		if(ts.isIntegerType(type)) return value
-		if(ts.isRealType(type)) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Float value, Type type) {
-		if(ts.isIntegerType(type)) return value.longValue
-		if(ts.isRealType(type)) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value.longValue
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Double value, Type type) {
-		if(ts.isIntegerType(type)) return value.longValue
-		if(ts.isRealType(type)) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value.longValue
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Boolean value, Type type) {
-		if(ts.isBooleanType(type)) return value
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.BOOLEAN))) return value
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(String value, Type type) {
-		if(ts.isStringType(type)) return value
+		if(ts.isSame(type, ts.getType(DefaultTypeSystem.STRING))) return value
 		throw new IllegalArgumentException
 	}
 
@@ -125,13 +126,12 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 		var scopeVariable = context.resolve(assignment.varRef)
 		var result = assignment.expression.execute
 		if (assignment.operator == AssignmentOperator::ASSIGN) {
-
 			//Strong typing, use the type of the scopeVariable instead of using new runtime type
-			scopeVariable.value = if(result != null) typeCast(result, scopeVariable.type.type) else null
+			scopeVariable.value = if(result != null) typeCast(result, scopeVariable.type) else null
 		} else {
 			var operator = AbstractStatementInterpreter::assignFunctionMap.get(assignment.operator.getName())
 			scopeVariable.value = if(result != null) typeCast(evaluate(operator, scopeVariable.getValue, result),
-				scopeVariable.type.type) else null
+				scopeVariable.type) else null
 		}
 		scopeVariable.value
 	}

+ 1 - 2
plugins/org.yakindu.sct.simulation.core/model/sruntime.ecore

@@ -32,13 +32,12 @@
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="direction" eType="#//EventDirection"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionSlot" abstract="true" eSuperTypes="../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//InferredType"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="#//JavaObject"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="fqName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="writable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
         defaultValueLiteral="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="ecore:EClass ../../org.yakindu.base.types/model/types.ecore#//Type"/>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EDataType" name="InferredType" instanceClassName="org.yakindu.base.types.InferredType"/>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionVariable" eSuperTypes="#//ExecutionSlot"/>
   <eClassifiers xsi:type="ecore:EClass" name="CompositeSlot" eSuperTypes="#//ExecutionSlot">
     <eStructuralFeatures xsi:type="ecore:EReference" name="slots" upperBound="-1"

+ 10 - 3
plugins/org.yakindu.sct.simulation.core/model/sruntime.genmodel

@@ -4,7 +4,7 @@
     modelDirectory="/org.yakindu.sct.simulation.core/src" modelPluginID="org.yakindu.sct.simulation.core"
     modelName="Sruntime" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
     suppressEMFTypes="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0"
-    copyrightFields="false" publicConstructors="true" usedGenPackages="../../org.yakindu.base.types/model/base.genmodel#//base ../../org.yakindu.sct.model.sgraph/model/emf/sgraph.genmodel#//sgraph"
+    copyrightFields="false" publicConstructors="true" usedGenPackages="../../org.yakindu.base.types/model/base.genmodel#//base ../../org.yakindu.sct.model.sgraph/model/emf/sgraph.genmodel#//sgraph ../../org.yakindu.base.types/model/types.genmodel#//types"
     interfaceNamePattern="" importOrganizing="true">
   <foreignModel>sruntime.ecore</foreignModel>
   <genPackages prefix="SRuntime" basePackage="org.yakindu.sct.simulation.core" disposableProviderFactory="true"
@@ -14,7 +14,6 @@
       <genEnumLiterals ecoreEnumLiteral="sruntime.ecore#//EventDirection/IN"/>
       <genEnumLiterals ecoreEnumLiteral="sruntime.ecore#//EventDirection/OUT"/>
     </genEnums>
-    <genDataTypes ecoreDataType="sruntime.ecore#//InferredType"/>
     <genDataTypes ecoreDataType="sruntime.ecore#//JavaObject"/>
     <genClasses ecoreClass="sruntime.ecore#//ExecutionContext">
       <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference sruntime.ecore#//ExecutionContext/activeStates"/>
@@ -32,6 +31,10 @@
       <genOperations ecoreOperation="sruntime.ecore#//ExecutionContext/getAllActiveStates"/>
       <genOperations ecoreOperation="sruntime.ecore#//ExecutionContext/getAllEvents"/>
       <genOperations ecoreOperation="sruntime.ecore#//ExecutionContext/getAllVariables"/>
+      <genOperations ecoreOperation="sruntime.ecore#//ExecutionContext/getAllSlots"/>
+      <genOperations ecoreOperation="sruntime.ecore#//ExecutionContext/getSlot">
+        <genParameters ecoreParameter="sruntime.ecore#//ExecutionContext/getSlot/qualifiedName"/>
+      </genOperations>
     </genClasses>
     <genClasses ecoreClass="sruntime.ecore#//ExecutionEvent">
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionEvent/raised"/>
@@ -39,13 +42,17 @@
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionEvent/direction"/>
     </genClasses>
     <genClasses image="false" ecoreClass="sruntime.ecore#//ExecutionSlot">
-      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionSlot/type"/>
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionSlot/value"/>
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionSlot/fqName"/>
+      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute sruntime.ecore#//ExecutionSlot/writable"/>
+      <genFeatures createChild="false" ecoreFeature="ecore:EReference sruntime.ecore#//ExecutionSlot/type"/>
     </genClasses>
     <genClasses ecoreClass="sruntime.ecore#//ExecutionVariable"/>
     <genClasses ecoreClass="sruntime.ecore#//CompositeSlot">
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sruntime.ecore#//CompositeSlot/slots"/>
     </genClasses>
+    <genClasses ecoreClass="sruntime.ecore#//ReferenceSlot">
+      <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference sruntime.ecore#//ReferenceSlot/reference"/>
+    </genClasses>
   </genPackages>
 </genmodel:GenModel>

+ 1 - 2
plugins/org.yakindu.sct.simulation.core/plugin.xml

@@ -10,6 +10,5 @@
             class="org.yakindu.sct.simulation.core.sruntime.SRuntimePackage"
             genModel="model/sruntime.genmodel"/>
    </extension>
-   
-   
+
 </plugin>

+ 9 - 10
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/ExecutionSlot.java

@@ -11,7 +11,6 @@
 package org.yakindu.sct.simulation.core.sruntime;
 
 import org.yakindu.base.base.NamedElement;
-import org.yakindu.base.types.InferredType;
 
 /**
  * <!-- begin-user-doc -->
@@ -21,10 +20,10 @@ import org.yakindu.base.types.InferredType;
  * <p>
  * The following features are supported:
  * <ul>
- *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getValue <em>Value</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getFqName <em>Fq Name</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#isWritable <em>Writable</em>}</li>
+ *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}</li>
  * </ul>
  * </p>
  *
@@ -34,30 +33,30 @@ import org.yakindu.base.types.InferredType;
  */
 public interface ExecutionSlot extends NamedElement {
 	/**
-	 * Returns the value of the '<em><b>Type</b></em>' attribute.
+	 * Returns the value of the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <p>
 	 * If the meaning of the '<em>Type</em>' attribute isn't clear,
 	 * there really should be more of a description here...
 	 * </p>
 	 * <!-- end-user-doc -->
-	 * @return the value of the '<em>Type</em>' attribute.
-	 * @see #setType(InferredType)
+	 * @return the value of the '<em>Type</em>' reference.
+	 * @see #setType(org.yakindu.base.types.Type)
 	 * @see org.yakindu.sct.simulation.core.sruntime.SRuntimePackage#getExecutionSlot_Type()
-	 * @model dataType="org.yakindu.sct.simulation.core.sruntime.InferredType"
+	 * @model
 	 * @generated
 	 */
-	InferredType getType();
+	org.yakindu.base.types.Type getType();
 
 	/**
-	 * Sets the value of the '{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}' attribute.
+	 * Sets the value of the '{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @param value the new value of the '<em>Type</em>' attribute.
+	 * @param value the new value of the '<em>Type</em>' reference.
 	 * @see #getType()
 	 * @generated
 	 */
-	void setType(InferredType value);
+	void setType(org.yakindu.base.types.Type value);
 
 	/**
 	 * Returns the value of the '<em><b>Value</b></em>' attribute.

+ 54 - 86
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/SRuntimePackage.java

@@ -87,40 +87,40 @@ public interface SRuntimePackage extends EPackage {
 	int EXECUTION_CONTEXT__NAME = BasePackage.NAMED_ELEMENT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_CONTEXT__TYPE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 0;
+	int EXECUTION_CONTEXT__VALUE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 0;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_CONTEXT__VALUE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 1;
+	int EXECUTION_CONTEXT__FQ_NAME = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 1;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_CONTEXT__FQ_NAME = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 2;
+	int EXECUTION_CONTEXT__WRITABLE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 2;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_CONTEXT__WRITABLE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 3;
+	int EXECUTION_CONTEXT__TYPE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 3;
 
 	/**
 	 * The feature id for the '<em><b>Slots</b></em>' containment reference list.
@@ -196,40 +196,40 @@ public interface SRuntimePackage extends EPackage {
 	int EXECUTION_SLOT__NAME = BasePackage.NAMED_ELEMENT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_SLOT__TYPE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 0;
+	int EXECUTION_SLOT__VALUE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 0;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_SLOT__VALUE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 1;
+	int EXECUTION_SLOT__FQ_NAME = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 1;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_SLOT__FQ_NAME = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 2;
+	int EXECUTION_SLOT__WRITABLE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 2;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_SLOT__WRITABLE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 3;
+	int EXECUTION_SLOT__TYPE = BasePackage.NAMED_ELEMENT_FEATURE_COUNT + 3;
 
 	/**
 	 * The number of structural features of the '<em>Execution Slot</em>' class.
@@ -260,40 +260,40 @@ public interface SRuntimePackage extends EPackage {
 	int EXECUTION_EVENT__NAME = EXECUTION_SLOT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_EVENT__TYPE = EXECUTION_SLOT__TYPE;
+	int EXECUTION_EVENT__VALUE = EXECUTION_SLOT__VALUE;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_EVENT__VALUE = EXECUTION_SLOT__VALUE;
+	int EXECUTION_EVENT__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_EVENT__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
+	int EXECUTION_EVENT__WRITABLE = EXECUTION_SLOT__WRITABLE;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_EVENT__WRITABLE = EXECUTION_SLOT__WRITABLE;
+	int EXECUTION_EVENT__TYPE = EXECUTION_SLOT__TYPE;
 
 	/**
 	 * The feature id for the '<em><b>Raised</b></em>' attribute.
@@ -351,40 +351,40 @@ public interface SRuntimePackage extends EPackage {
 	int EXECUTION_VARIABLE__NAME = EXECUTION_SLOT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_VARIABLE__TYPE = EXECUTION_SLOT__TYPE;
+	int EXECUTION_VARIABLE__VALUE = EXECUTION_SLOT__VALUE;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_VARIABLE__VALUE = EXECUTION_SLOT__VALUE;
+	int EXECUTION_VARIABLE__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_VARIABLE__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
+	int EXECUTION_VARIABLE__WRITABLE = EXECUTION_SLOT__WRITABLE;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_VARIABLE__WRITABLE = EXECUTION_SLOT__WRITABLE;
+	int EXECUTION_VARIABLE__TYPE = EXECUTION_SLOT__TYPE;
 
 	/**
 	 * The number of structural features of the '<em>Execution Variable</em>' class.
@@ -415,40 +415,40 @@ public interface SRuntimePackage extends EPackage {
 	int COMPOSITE_SLOT__NAME = EXECUTION_SLOT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int COMPOSITE_SLOT__TYPE = EXECUTION_SLOT__TYPE;
+	int COMPOSITE_SLOT__VALUE = EXECUTION_SLOT__VALUE;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int COMPOSITE_SLOT__VALUE = EXECUTION_SLOT__VALUE;
+	int COMPOSITE_SLOT__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int COMPOSITE_SLOT__FQ_NAME = EXECUTION_SLOT__FQ_NAME;
+	int COMPOSITE_SLOT__WRITABLE = EXECUTION_SLOT__WRITABLE;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int COMPOSITE_SLOT__WRITABLE = EXECUTION_SLOT__WRITABLE;
+	int COMPOSITE_SLOT__TYPE = EXECUTION_SLOT__TYPE;
 
 	/**
 	 * The feature id for the '<em><b>Slots</b></em>' containment reference list.
@@ -488,40 +488,40 @@ public interface SRuntimePackage extends EPackage {
 	int REFERENCE_SLOT__NAME = COMPOSITE_SLOT__NAME;
 
 	/**
-	 * The feature id for the '<em><b>Type</b></em>' attribute.
+	 * The feature id for the '<em><b>Value</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int REFERENCE_SLOT__TYPE = COMPOSITE_SLOT__TYPE;
+	int REFERENCE_SLOT__VALUE = COMPOSITE_SLOT__VALUE;
 
 	/**
-	 * The feature id for the '<em><b>Value</b></em>' attribute.
+	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int REFERENCE_SLOT__VALUE = COMPOSITE_SLOT__VALUE;
+	int REFERENCE_SLOT__FQ_NAME = COMPOSITE_SLOT__FQ_NAME;
 
 	/**
-	 * The feature id for the '<em><b>Fq Name</b></em>' attribute.
+	 * The feature id for the '<em><b>Writable</b></em>' attribute.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int REFERENCE_SLOT__FQ_NAME = COMPOSITE_SLOT__FQ_NAME;
+	int REFERENCE_SLOT__WRITABLE = COMPOSITE_SLOT__WRITABLE;
 
 	/**
-	 * The feature id for the '<em><b>Writable</b></em>' attribute.
+	 * The feature id for the '<em><b>Type</b></em>' reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int REFERENCE_SLOT__WRITABLE = COMPOSITE_SLOT__WRITABLE;
+	int REFERENCE_SLOT__TYPE = COMPOSITE_SLOT__TYPE;
 
 	/**
 	 * The feature id for the '<em><b>Slots</b></em>' containment reference list.
@@ -560,17 +560,6 @@ public interface SRuntimePackage extends EPackage {
 	 */
 	int EVENT_DIRECTION = 6;
 
-	/**
-	 * The meta object id for the '<em>Inferred Type</em>' data type.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see org.yakindu.base.types.InferredType
-	 * @see org.yakindu.sct.simulation.core.sruntime.impl.SRuntimePackageImpl#getInferredType()
-	 * @generated
-	 */
-	int INFERRED_TYPE = 7;
-
-
 	/**
 	 * The meta object id for the '<em>Java Object</em>' data type.
 	 * <!-- begin-user-doc -->
@@ -579,7 +568,7 @@ public interface SRuntimePackage extends EPackage {
 	 * @see org.yakindu.sct.simulation.core.sruntime.impl.SRuntimePackageImpl#getJavaObject()
 	 * @generated
 	 */
-	int JAVA_OBJECT = 8;
+	int JAVA_OBJECT = 7;
 
 
 	/**
@@ -690,15 +679,15 @@ public interface SRuntimePackage extends EPackage {
 	EClass getExecutionSlot();
 
 	/**
-	 * Returns the meta object for the attribute '{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}'.
+	 * Returns the meta object for the reference '{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType <em>Type</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for the attribute '<em>Type</em>'.
+	 * @return the meta object for the reference '<em>Type</em>'.
 	 * @see org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getType()
 	 * @see #getExecutionSlot()
 	 * @generated
 	 */
-	EAttribute getExecutionSlot_Type();
+	EReference getExecutionSlot_Type();
 
 	/**
 	 * Returns the meta object for the attribute '{@link org.yakindu.sct.simulation.core.sruntime.ExecutionSlot#getValue <em>Value</em>}'.
@@ -795,17 +784,6 @@ public interface SRuntimePackage extends EPackage {
 	 */
 	EEnum getEventDirection();
 
-	/**
-	 * Returns the meta object for data type '{@link org.yakindu.base.types.InferredType <em>Inferred Type</em>}'.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @return the meta object for data type '<em>Inferred Type</em>'.
-	 * @see org.yakindu.base.types.InferredType
-	 * @model instanceClass="org.yakindu.base.types.InferredType"
-	 * @generated
-	 */
-	EDataType getInferredType();
-
 	/**
 	 * Returns the meta object for data type '{@link java.lang.Object <em>Java Object</em>}'.
 	 * <!-- begin-user-doc -->
@@ -926,12 +904,12 @@ public interface SRuntimePackage extends EPackage {
 		EClass EXECUTION_SLOT = eINSTANCE.getExecutionSlot();
 
 		/**
-		 * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
+		 * The meta object literal for the '<em><b>Type</b></em>' reference feature.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
 		 * @generated
 		 */
-		EAttribute EXECUTION_SLOT__TYPE = eINSTANCE.getExecutionSlot_Type();
+		EReference EXECUTION_SLOT__TYPE = eINSTANCE.getExecutionSlot_Type();
 
 		/**
 		 * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
@@ -1013,16 +991,6 @@ public interface SRuntimePackage extends EPackage {
 		 */
 		EEnum EVENT_DIRECTION = eINSTANCE.getEventDirection();
 
-		/**
-		 * The meta object literal for the '<em>Inferred Type</em>' data type.
-		 * <!-- begin-user-doc -->
-		 * <!-- end-user-doc -->
-		 * @see org.yakindu.base.types.InferredType
-		 * @see org.yakindu.sct.simulation.core.sruntime.impl.SRuntimePackageImpl#getInferredType()
-		 * @generated
-		 */
-		EDataType INFERRED_TYPE = eINSTANCE.getInferredType();
-
 		/**
 		 * The meta object literal for the '<em>Java Object</em>' data type.
 		 * <!-- begin-user-doc -->

+ 44 - 38
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ExecutionContextImpl.java

@@ -27,7 +27,6 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList;
 import org.eclipse.emf.ecore.util.EObjectResolvingEList;
 import org.eclipse.emf.ecore.util.InternalEList;
 import org.yakindu.base.base.impl.NamedElementImpl;
-import org.yakindu.base.types.InferredType;
 import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.simulation.core.sruntime.CompositeSlot;
@@ -47,10 +46,10 @@ import com.google.common.collect.Sets;
  * <p>
  * The following features are implemented:
  * <ul>
- *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getType <em>Type</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getValue <em>Value</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getFqName <em>Fq Name</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#isWritable <em>Writable</em>}</li>
+ *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getType <em>Type</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getSlots <em>Slots</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getActiveStates <em>Active States</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl#getExecutedElements <em>Executed Elements</em>}</li>
@@ -62,24 +61,6 @@ import com.google.common.collect.Sets;
  * @generated
  */
 public class ExecutionContextImpl extends NamedElementImpl implements ExecutionContext {
-	/**
-	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * @see #getType()
-	 * @generated
-	 * @ordered
-	 */
-	protected static final InferredType TYPE_EDEFAULT = null;
-
-	/**
-	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * @see #getType()
-	 * @generated
-	 * @ordered
-	 */
-	protected InferredType type = TYPE_EDEFAULT;
-
 	/**
 	 * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -138,6 +119,15 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	 */
 	protected boolean writable = WRITABLE_EDEFAULT;
 
+	/**
+	 * The cached value of the '{@link #getType() <em>Type</em>}' reference.
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * @see #getType()
+	 * @generated
+	 * @ordered
+	 */
+	protected org.yakindu.base.types.Type type;
+
 	/**
 	 * The cached value of the '{@link #getSlots() <em>Slots</em>}' containment reference list.
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -216,7 +206,15 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * @generated
 	 */
-	public InferredType getType() {
+	public org.yakindu.base.types.Type getType() {
+		if (type != null && type.eIsProxy()) {
+			InternalEObject oldType = (InternalEObject)type;
+			type = (org.yakindu.base.types.Type)eResolveProxy(oldType);
+			if (type != oldType) {
+				if (eNotificationRequired())
+					eNotify(new ENotificationImpl(this, Notification.RESOLVE, SRuntimePackage.EXECUTION_CONTEXT__TYPE, oldType, type));
+			}
+		}
 		return type;
 	}
 
@@ -225,8 +223,17 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public void setType(InferredType newType) {
-		InferredType oldType = type;
+	public org.yakindu.base.types.Type basicGetType() {
+		return type;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setType(org.yakindu.base.types.Type newType) {
+		org.yakindu.base.types.Type oldType = type;
 		type = newType;
 		if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, SRuntimePackage.EXECUTION_CONTEXT__TYPE, oldType, type));
@@ -545,14 +552,15 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	@Override
 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
-				return getType();
 			case SRuntimePackage.EXECUTION_CONTEXT__VALUE:
 				return getValue();
 			case SRuntimePackage.EXECUTION_CONTEXT__FQ_NAME:
 				return getFqName();
 			case SRuntimePackage.EXECUTION_CONTEXT__WRITABLE:
 				return isWritable();
+			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
+				if (resolve) return getType();
+				return basicGetType();
 			case SRuntimePackage.EXECUTION_CONTEXT__SLOTS:
 				return getSlots();
 			case SRuntimePackage.EXECUTION_CONTEXT__ACTIVE_STATES:
@@ -575,9 +583,6 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	@Override
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
-				setType((InferredType)newValue);
-				return;
 			case SRuntimePackage.EXECUTION_CONTEXT__VALUE:
 				setValue(newValue);
 				return;
@@ -587,6 +592,9 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 			case SRuntimePackage.EXECUTION_CONTEXT__WRITABLE:
 				setWritable((Boolean)newValue);
 				return;
+			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
+				setType((org.yakindu.base.types.Type)newValue);
+				return;
 			case SRuntimePackage.EXECUTION_CONTEXT__SLOTS:
 				getSlots().clear();
 				getSlots().addAll((Collection<? extends ExecutionSlot>)newValue);
@@ -617,9 +625,6 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	@Override
 	public void eUnset(int featureID) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
-				setType(TYPE_EDEFAULT);
-				return;
 			case SRuntimePackage.EXECUTION_CONTEXT__VALUE:
 				setValue(VALUE_EDEFAULT);
 				return;
@@ -629,6 +634,9 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 			case SRuntimePackage.EXECUTION_CONTEXT__WRITABLE:
 				setWritable(WRITABLE_EDEFAULT);
 				return;
+			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
+				setType((org.yakindu.base.types.Type)null);
+				return;
 			case SRuntimePackage.EXECUTION_CONTEXT__SLOTS:
 				getSlots().clear();
 				return;
@@ -655,14 +663,14 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	@Override
 	public boolean eIsSet(int featureID) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
-				return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
 			case SRuntimePackage.EXECUTION_CONTEXT__VALUE:
 				return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
 			case SRuntimePackage.EXECUTION_CONTEXT__FQ_NAME:
 				return FQ_NAME_EDEFAULT == null ? fqName != null : !FQ_NAME_EDEFAULT.equals(fqName);
 			case SRuntimePackage.EXECUTION_CONTEXT__WRITABLE:
 				return writable != WRITABLE_EDEFAULT;
+			case SRuntimePackage.EXECUTION_CONTEXT__TYPE:
+				return type != null;
 			case SRuntimePackage.EXECUTION_CONTEXT__SLOTS:
 				return slots != null && !slots.isEmpty();
 			case SRuntimePackage.EXECUTION_CONTEXT__ACTIVE_STATES:
@@ -685,10 +693,10 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
 		if (baseClass == ExecutionSlot.class) {
 			switch (derivedFeatureID) {
-				case SRuntimePackage.EXECUTION_CONTEXT__TYPE: return SRuntimePackage.EXECUTION_SLOT__TYPE;
 				case SRuntimePackage.EXECUTION_CONTEXT__VALUE: return SRuntimePackage.EXECUTION_SLOT__VALUE;
 				case SRuntimePackage.EXECUTION_CONTEXT__FQ_NAME: return SRuntimePackage.EXECUTION_SLOT__FQ_NAME;
 				case SRuntimePackage.EXECUTION_CONTEXT__WRITABLE: return SRuntimePackage.EXECUTION_SLOT__WRITABLE;
+				case SRuntimePackage.EXECUTION_CONTEXT__TYPE: return SRuntimePackage.EXECUTION_SLOT__TYPE;
 				default: return -1;
 			}
 		}
@@ -709,10 +717,10 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 	public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
 		if (baseClass == ExecutionSlot.class) {
 			switch (baseFeatureID) {
-				case SRuntimePackage.EXECUTION_SLOT__TYPE: return SRuntimePackage.EXECUTION_CONTEXT__TYPE;
 				case SRuntimePackage.EXECUTION_SLOT__VALUE: return SRuntimePackage.EXECUTION_CONTEXT__VALUE;
 				case SRuntimePackage.EXECUTION_SLOT__FQ_NAME: return SRuntimePackage.EXECUTION_CONTEXT__FQ_NAME;
 				case SRuntimePackage.EXECUTION_SLOT__WRITABLE: return SRuntimePackage.EXECUTION_CONTEXT__WRITABLE;
+				case SRuntimePackage.EXECUTION_SLOT__TYPE: return SRuntimePackage.EXECUTION_CONTEXT__TYPE;
 				default: return -1;
 			}
 		}
@@ -734,9 +742,7 @@ public class ExecutionContextImpl extends NamedElementImpl implements ExecutionC
 		if (eIsProxy()) return super.toString();
 
 		StringBuffer result = new StringBuffer(super.toString());
-		result.append(" (type: ");
-		result.append(type);
-		result.append(", value: ");
+		result.append(" (value: ");
 		result.append(value);
 		result.append(", fqName: ");
 		result.append(fqName);

+ 43 - 35
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ExecutionSlotImpl.java

@@ -12,9 +12,9 @@ package org.yakindu.sct.simulation.core.sruntime.impl;
 
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.yakindu.base.base.impl.NamedElementImpl;
-import org.yakindu.base.types.InferredType;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot;
 import org.yakindu.sct.simulation.core.sruntime.SRuntimePackage;
 
@@ -25,36 +25,16 @@ import org.yakindu.sct.simulation.core.sruntime.SRuntimePackage;
  * <p>
  * The following features are implemented:
  * <ul>
- *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl#getType <em>Type</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl#getValue <em>Value</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl#getFqName <em>Fq Name</em>}</li>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl#isWritable <em>Writable</em>}</li>
+ *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl#getType <em>Type</em>}</li>
  * </ul>
  * </p>
  *
  * @generated
  */
 public abstract class ExecutionSlotImpl extends NamedElementImpl implements ExecutionSlot {
-	/**
-	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #getType()
-	 * @generated
-	 * @ordered
-	 */
-	protected static final InferredType TYPE_EDEFAULT = null;
-
-	/**
-	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #getType()
-	 * @generated
-	 * @ordered
-	 */
-	protected InferredType type = TYPE_EDEFAULT;
-
 	/**
 	 * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -115,6 +95,16 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	 */
 	protected boolean writable = WRITABLE_EDEFAULT;
 
+	/**
+	 * The cached value of the '{@link #getType() <em>Type</em>}' reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getType()
+	 * @generated
+	 * @ordered
+	 */
+	protected org.yakindu.base.types.Type type;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -139,7 +129,24 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public InferredType getType() {
+	public org.yakindu.base.types.Type getType() {
+		if (type != null && type.eIsProxy()) {
+			InternalEObject oldType = (InternalEObject)type;
+			type = (org.yakindu.base.types.Type)eResolveProxy(oldType);
+			if (type != oldType) {
+				if (eNotificationRequired())
+					eNotify(new ENotificationImpl(this, Notification.RESOLVE, SRuntimePackage.EXECUTION_SLOT__TYPE, oldType, type));
+			}
+		}
+		return type;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public org.yakindu.base.types.Type basicGetType() {
 		return type;
 	}
 
@@ -148,8 +155,8 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public void setType(InferredType newType) {
-		InferredType oldType = type;
+	public void setType(org.yakindu.base.types.Type newType) {
+		org.yakindu.base.types.Type oldType = type;
 		type = newType;
 		if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, SRuntimePackage.EXECUTION_SLOT__TYPE, oldType, type));
@@ -226,14 +233,15 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	@Override
 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_SLOT__TYPE:
-				return getType();
 			case SRuntimePackage.EXECUTION_SLOT__VALUE:
 				return getValue();
 			case SRuntimePackage.EXECUTION_SLOT__FQ_NAME:
 				return getFqName();
 			case SRuntimePackage.EXECUTION_SLOT__WRITABLE:
 				return isWritable();
+			case SRuntimePackage.EXECUTION_SLOT__TYPE:
+				if (resolve) return getType();
+				return basicGetType();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -246,9 +254,6 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	@Override
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_SLOT__TYPE:
-				setType((InferredType)newValue);
-				return;
 			case SRuntimePackage.EXECUTION_SLOT__VALUE:
 				setValue(newValue);
 				return;
@@ -258,6 +263,9 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 			case SRuntimePackage.EXECUTION_SLOT__WRITABLE:
 				setWritable((Boolean)newValue);
 				return;
+			case SRuntimePackage.EXECUTION_SLOT__TYPE:
+				setType((org.yakindu.base.types.Type)newValue);
+				return;
 		}
 		super.eSet(featureID, newValue);
 	}
@@ -270,9 +278,6 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	@Override
 	public void eUnset(int featureID) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_SLOT__TYPE:
-				setType(TYPE_EDEFAULT);
-				return;
 			case SRuntimePackage.EXECUTION_SLOT__VALUE:
 				setValue(VALUE_EDEFAULT);
 				return;
@@ -282,6 +287,9 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 			case SRuntimePackage.EXECUTION_SLOT__WRITABLE:
 				setWritable(WRITABLE_EDEFAULT);
 				return;
+			case SRuntimePackage.EXECUTION_SLOT__TYPE:
+				setType((org.yakindu.base.types.Type)null);
+				return;
 		}
 		super.eUnset(featureID);
 	}
@@ -294,14 +302,14 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	@Override
 	public boolean eIsSet(int featureID) {
 		switch (featureID) {
-			case SRuntimePackage.EXECUTION_SLOT__TYPE:
-				return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
 			case SRuntimePackage.EXECUTION_SLOT__VALUE:
 				return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
 			case SRuntimePackage.EXECUTION_SLOT__FQ_NAME:
 				return FQ_NAME_EDEFAULT == null ? fqName != null : !FQ_NAME_EDEFAULT.equals(fqName);
 			case SRuntimePackage.EXECUTION_SLOT__WRITABLE:
 				return writable != WRITABLE_EDEFAULT;
+			case SRuntimePackage.EXECUTION_SLOT__TYPE:
+				return type != null;
 		}
 		return super.eIsSet(featureID);
 	}

+ 1 - 27
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimeFactoryImpl.java

@@ -16,15 +16,12 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.impl.EFactoryImpl;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.yakindu.base.types.InferredType;
-import org.yakindu.base.types.PrimitiveType;
-import org.yakindu.base.types.TypesFactory;
-import org.yakindu.sct.simulation.core.sruntime.*;
 import org.yakindu.sct.simulation.core.sruntime.CompositeSlot;
 import org.yakindu.sct.simulation.core.sruntime.EventDirection;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+import org.yakindu.sct.simulation.core.sruntime.ReferenceSlot;
 import org.yakindu.sct.simulation.core.sruntime.SRuntimeFactory;
 import org.yakindu.sct.simulation.core.sruntime.SRuntimePackage;
 
@@ -89,8 +86,6 @@ public class SRuntimeFactoryImpl extends EFactoryImpl implements SRuntimeFactory
 		switch (eDataType.getClassifierID()) {
 			case SRuntimePackage.EVENT_DIRECTION:
 				return createEventDirectionFromString(eDataType, initialValue);
-			case SRuntimePackage.INFERRED_TYPE:
-				return createInferredTypeFromString(eDataType, initialValue);
 			case SRuntimePackage.JAVA_OBJECT:
 				return createJavaObjectFromString(eDataType, initialValue);
 			default:
@@ -107,8 +102,6 @@ public class SRuntimeFactoryImpl extends EFactoryImpl implements SRuntimeFactory
 		switch (eDataType.getClassifierID()) {
 			case SRuntimePackage.EVENT_DIRECTION:
 				return convertEventDirectionToString(eDataType, instanceValue);
-			case SRuntimePackage.INFERRED_TYPE:
-				return convertInferredTypeToString(eDataType, instanceValue);
 			case SRuntimePackage.JAVA_OBJECT:
 				return convertJavaObjectToString(eDataType, instanceValue);
 			default:
@@ -180,25 +173,6 @@ public class SRuntimeFactoryImpl extends EFactoryImpl implements SRuntimeFactory
 		return instanceValue == null ? null : instanceValue.toString();
 	}
 
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public InferredType createInferredTypeFromString(EDataType eDataType, String initialValue) {
-		PrimitiveType type = TypesFactory.eINSTANCE.createPrimitiveType();
-		type.setName(initialValue);
-		return new InferredType(type);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * @generated
-	 */
-	public String convertInferredTypeToString(EDataType eDataType, Object instanceValue) {
-		return super.convertToString(eDataType, instanceValue);
-	}
-
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 

+ 9 - 26
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimePackageImpl.java

@@ -19,7 +19,6 @@ import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.impl.EPackageImpl;
 import org.yakindu.base.base.BasePackage;
-import org.yakindu.base.types.InferredType;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.simulation.core.sruntime.CompositeSlot;
 import org.yakindu.sct.simulation.core.sruntime.EventDirection;
@@ -87,13 +86,6 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 	 */
 	private EEnum eventDirectionEEnum = null;
 
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private EDataType inferredTypeEDataType = null;
-
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -149,6 +141,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 
 		// Initialize simple dependencies
 		SGraphPackage.eINSTANCE.eClass();
+		org.yakindu.base.types.TypesPackage.eINSTANCE.eClass();
 
 		// Create package meta-data objects
 		theSRuntimePackage.createPackageContents();
@@ -260,8 +253,8 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EAttribute getExecutionSlot_Type() {
-		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(0);
+	public EReference getExecutionSlot_Type() {
+		return (EReference)executionSlotEClass.getEStructuralFeatures().get(3);
 	}
 
 	/**
@@ -270,7 +263,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 	 * @generated
 	 */
 	public EAttribute getExecutionSlot_Value() {
-		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(1);
+		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(0);
 	}
 
 	/**
@@ -279,7 +272,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 	 * @generated
 	 */
 	public EAttribute getExecutionSlot_FqName() {
-		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(2);
+		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(1);
 	}
 
 	/**
@@ -288,7 +281,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 	 * @generated
 	 */
 	public EAttribute getExecutionSlot_Writable() {
-		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(3);
+		return (EAttribute)executionSlotEClass.getEStructuralFeatures().get(2);
 	}
 
 	/**
@@ -345,15 +338,6 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		return eventDirectionEEnum;
 	}
 
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public EDataType getInferredType() {
-		return inferredTypeEDataType;
-	}
-
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -403,10 +387,10 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		createEAttribute(executionEventEClass, EXECUTION_EVENT__DIRECTION);
 
 		executionSlotEClass = createEClass(EXECUTION_SLOT);
-		createEAttribute(executionSlotEClass, EXECUTION_SLOT__TYPE);
 		createEAttribute(executionSlotEClass, EXECUTION_SLOT__VALUE);
 		createEAttribute(executionSlotEClass, EXECUTION_SLOT__FQ_NAME);
 		createEAttribute(executionSlotEClass, EXECUTION_SLOT__WRITABLE);
+		createEReference(executionSlotEClass, EXECUTION_SLOT__TYPE);
 
 		executionVariableEClass = createEClass(EXECUTION_VARIABLE);
 
@@ -420,7 +404,6 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		eventDirectionEEnum = createEEnum(EVENT_DIRECTION);
 
 		// Create data types
-		inferredTypeEDataType = createEDataType(INFERRED_TYPE);
 		javaObjectEDataType = createEDataType(JAVA_OBJECT);
 	}
 
@@ -450,6 +433,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		// Obtain other dependent packages
 		BasePackage theBasePackage = (BasePackage)EPackage.Registry.INSTANCE.getEPackage(BasePackage.eNS_URI);
 		SGraphPackage theSGraphPackage = (SGraphPackage)EPackage.Registry.INSTANCE.getEPackage(SGraphPackage.eNS_URI);
+		org.yakindu.base.types.TypesPackage theTypesPackage = (org.yakindu.base.types.TypesPackage)EPackage.Registry.INSTANCE.getEPackage(org.yakindu.base.types.TypesPackage.eNS_URI);
 
 		// Create type parameters
 
@@ -498,10 +482,10 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		initEAttribute(getExecutionEvent_Direction(), this.getEventDirection(), "direction", null, 0, 1, ExecutionEvent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionSlotEClass, ExecutionSlot.class, "ExecutionSlot", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEAttribute(getExecutionSlot_Type(), this.getInferredType(), "type", null, 0, 1, ExecutionSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEAttribute(getExecutionSlot_Value(), this.getJavaObject(), "value", null, 0, 1, ExecutionSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEAttribute(getExecutionSlot_FqName(), ecorePackage.getEString(), "fqName", null, 0, 1, ExecutionSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEAttribute(getExecutionSlot_Writable(), ecorePackage.getEBoolean(), "writable", "true", 0, 1, ExecutionSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionSlot_Type(), theTypesPackage.getType(), null, "type", null, 0, 1, ExecutionSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionVariableEClass, ExecutionVariable.class, "ExecutionVariable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 
@@ -518,7 +502,6 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		addEEnumLiteral(eventDirectionEEnum, EventDirection.OUT);
 
 		// Initialize data types
-		initEDataType(inferredTypeEDataType, InferredType.class, "InferredType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
 		initEDataType(javaObjectEDataType, Object.class, "JavaObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
 
 		// Create resource

+ 1 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/EnumerationEditingSupport.java

@@ -49,7 +49,7 @@ public class EnumerationEditingSupport extends ScopeSlotEditingSupport {
 	}
 
 	public EnumerationType getEnumerationType(ExecutionSlot element) {
-		EnumerationType e = (EnumerationType) element.getType().getType();
+		EnumerationType e = (EnumerationType) element.getType();
 		return e;
 	}
 

+ 49 - 73
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/TypeInferrerTest.java

@@ -13,7 +13,6 @@ package org.yakindu.sct.model.stext.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import junit.framework.TestCase;
 
 import org.eclipse.emf.ecore.EObject;
@@ -24,8 +23,9 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.base.types.ITypeSystem;
-import org.yakindu.base.types.InferenceResult;
+import org.yakindu.base.types.Type;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer.ITypeTraceAcceptor.TypeTrace.Severity;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.stext.stext.EventDefinition;
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
@@ -33,7 +33,6 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition;
 import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
 import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
 import org.yakindu.sct.model.stext.test.util.STextTestScopeProvider;
-import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
 
 import com.google.inject.Inject;
 
@@ -50,9 +49,11 @@ public class TypeInferrerTest extends AbstractSTextTest {
 	@Rule
 	public ExpectedException exception = ExpectedException.none();
 	@Inject
-	public ITypeSystem typeSystem;
+	public org.yakindu.base.types.typesystem.ITypeSystem typeSystem;
 	@Inject
-	private ISTextTypeInferrer typeInferrer;
+	private ITypeSystemInferrer typeInferrer;
+
+	private ITypeSystemInferrer.ListBasedTypeTraceAcceptor acceptor;
 
 	// Unary
 	@Test
@@ -273,10 +274,10 @@ public class TypeInferrerTest extends AbstractSTextTest {
 				"Logical operator '&&' may only be applied on boolean types, not on real and boolean.");
 		expectIssue(inferType("5 && boolEvent"),
 				"Logical operator '&&' may only be applied on boolean types, not on integer and boolean.");
-		expectIssue(inferType("5 && 'string'"),
-				"Logical operator '&&' may only be applied on boolean types, not on integer and string.");
-		expectIssue(inferType("5 && 1.2"),
-				"Logical operator '&&' may only be applied on boolean types, not on integer and real.");
+		expectIssue(inferType("true && 'string'"),
+				"Logical operator '&&' may only be applied on boolean types, not on boolean and string.");
+		expectIssue(inferType("true && 1.2"),
+				"Logical operator '&&' may only be applied on boolean types, not on boolean and real.");
 	}
 
 	// LogicalOrExpression
@@ -504,26 +505,26 @@ public class TypeInferrerTest extends AbstractSTextTest {
 		expectIssue(inferType("intVar = boolVar"),
 				"Assignment operator '=' may only be applied on compatible types, not on integer and boolean.");
 		expectIssue(inferType("intVar &= boolVar"),
-				"Bitwise operator '&=' may only be applied on integer types, not on integer and boolean.");
+				"Assignment operator '&=' may only be applied on compatible types, not on integer and boolean.");
 		expectIssue(inferType("intVar |= boolVar"),
-				"Bitwise operator '|=' may only be applied on integer types, not on integer and boolean.");
+				"Assignment operator '|=' may only be applied on compatible types, not on integer and boolean.");
 		expectIssue(inferType("intVar ^= boolVar"),
-				"Bitwise operator '^=' may only be applied on integer types, not on integer and boolean.");
+				"Assignment operator '^=' may only be applied on compatible types, not on integer and boolean.");
 		expectIssue(inferType("intVar >>= boolVar"),
-				"Bitwise operator '>>=' may only be applied on integer types, not on integer and boolean.");
+				"Assignment operator '>>=' may only be applied on compatible types, not on integer and boolean.");
 		expectIssue(inferType("intVar <<= boolVar"),
-				"Bitwise operator '<<=' may only be applied on integer types, not on integer and boolean.");
+				"Assignment operator '<<=' may only be applied on compatible types, not on integer and boolean.");
 		// integer and string
 		expectIssue(inferType("intVar &= 'string'"),
-				"Bitwise operator '&=' may only be applied on integer types, not on integer and string.");
+				"Assignment operator '&=' may only be applied on compatible types, not on integer and string.");
 		expectIssue(inferType("intVar |= 'string'"),
-				"Bitwise operator '|=' may only be applied on integer types, not on integer and string.");
+				"Assignment operator '|=' may only be applied on compatible types, not on integer and string.");
 		expectIssue(inferType("intVar ^= 'string'"),
-				"Bitwise operator '^=' may only be applied on integer types, not on integer and string.");
+				"Assignment operator '^=' may only be applied on compatible types, not on integer and string.");
 		expectIssue(inferType("intVar >>= 'string'"),
-				"Bitwise operator '>>=' may only be applied on integer types, not on integer and string.");
+				"Assignment operator '>>=' may only be applied on compatible types, not on integer and string.");
 		expectIssue(inferType("intVar <<= 'string'"),
-				"Bitwise operator '<<=' may only be applied on integer types, not on integer and string.");
+				"Assignment operator '<<=' may only be applied on compatible types, not on integer and string.");
 	}
 
 	/**
@@ -689,7 +690,6 @@ public class TypeInferrerTest extends AbstractSTextTest {
 		expectIssue(
 				inferType("var boolVar : boolean = 'text'", VariableDefinition.class.getSimpleName(), interfaceScope()),
 				"Cannot assign a value of type string to a variable of type boolean.");
-
 		expectIssue(
 				inferType("var intVar : integer = true", VariableDefinition.class.getSimpleName(), interfaceScope()),
 				"Cannot assign a value of type boolean to a variable of type integer.");
@@ -746,7 +746,7 @@ public class TypeInferrerTest extends AbstractSTextTest {
 		assertTrue(isRealType(inferType("( 7.5 / 1.2 )")));
 		assertTrue(isStringType(inferType("( 'abc' )")));
 	}
-	
+
 	@Test
 	public void testTypeCastExpressionSuccess() {
 		assertTrue(isBooleanType(inferType("( true as boolean)")));
@@ -754,16 +754,13 @@ public class TypeInferrerTest extends AbstractSTextTest {
 		assertTrue(isRealType(inferType(" 7 as real ")));
 		assertTrue(isStringType(inferType("( 'abc' as string )")));
 	}
+
 	@Test
 	public void testTypeCastExpressionFailure() {
-		expectIssue(inferType("true as integer"),
-				"Cannot cast from boolean to integer.");
-		expectIssue(inferType("true as string"),
-				"Cannot cast from boolean to string.");
-		expectIssue(inferType("5 as string"),
-				"Cannot cast from integer to string.");
-		expectIssue(inferType("5.5 as string"),
-				"Cannot cast from real to string.");
+		expectIssue(inferType("true as integer"), "Cannot cast from boolean to integer.");
+		expectIssue(inferType("true as string"), "Cannot cast from boolean to string.");
+		expectIssue(inferType("5 as string"), "Cannot cast from integer to string.");
+		expectIssue(inferType("5.5 as string"), "Cannot cast from real to string.");
 	}
 
 	@Test
@@ -771,82 +768,61 @@ public class TypeInferrerTest extends AbstractSTextTest {
 		assertTrue(isIntegerType(inferType("(1<2) ? 4 : 5")));
 		assertTrue(isBooleanType(inferType("(true) ? false : true")));
 
-		expectIssue(inferType("(true) ? 4 : false"),
-				"Cannot compute a type union for the given types: integer, boolean");
+		expectIssue(inferType("(true) ? 4 : false"), "Could not determine a common type for integer and boolean.");
 	}
 
-	protected InferenceResult inferType(String expression) {
+	protected Type inferType(String expression) {
 		return inferType(expression, super.internalScope(), super.interfaceScope());
 	}
 
-	protected InferenceResult inferType(String expression, String parserRule) {
+	protected Type inferType(String expression, String parserRule) {
 		return inferType(expression, parserRule, super.internalScope(), super.interfaceScope());
 	}
 
-	protected InferenceResult inferType(String expression, Scope... scopes) {
+	protected Type inferType(String expression, Scope... scopes) {
 		return inferType(expression, Expression.class.getSimpleName(), scopes);
 	}
 
-	protected InferenceResult inferType(String expression, String parserRule, Scope... scopes) {
+	protected Type inferType(String expression, String parserRule, Scope... scopes) {
 		EObject parseResult = super.parseExpression(expression, parserRule, scopes);
 		assertNotNull(parseResult);
+		acceptor = new ITypeSystemInferrer.ListBasedTypeTraceAcceptor();
 		if (parseResult instanceof Expression) {
-			return typeInferrer.inferType((Expression) parseResult);
+			return typeInferrer.inferType((Expression) parseResult, acceptor);
 		} else if (parseResult instanceof EventDefinition) {
-			return typeInferrer.inferType((EventDefinition) parseResult);
+			return typeInferrer.inferType((EventDefinition) parseResult, acceptor);
 		} else if (parseResult instanceof VariableDefinition) {
-			return typeInferrer.inferType((VariableDefinition) parseResult);
+			return typeInferrer.inferType((VariableDefinition) parseResult, acceptor);
 		} else {
 			throw new IllegalArgumentException("Unsupported parse result.");
 		}
 	}
 
-	private boolean isVoidType(InferenceResult inferenceResult) {
-		if (inferenceResult.getType() == null) {
-			throw new IllegalArgumentException();
-		}
-		return typeSystem.isVoidType(inferenceResult.getType());
+	private boolean isVoidType(Type type) {
+		return typeSystem.isSame(type, typeSystem.getType("void"));
 	}
 
-	private boolean isIntegerType(InferenceResult inferenceResult) {
-		if (inferenceResult.getType() == null) {
-			throw new IllegalArgumentException(inferenceResult.getIssues().iterator().next().getMessage());
-		}
-		return typeSystem.isIntegerType(inferenceResult.getType());
+	private boolean isIntegerType(Type type) {
+		return typeSystem.isSame(type, typeSystem.getType("integer"));
 	}
 
-	private boolean isRealType(InferenceResult inferenceResult) {
-		if (inferenceResult.getType() == null) {
-			throw new IllegalArgumentException(inferenceResult.getIssues().iterator().next().getMessage());
-		}
-		return typeSystem.isRealType(inferenceResult.getType());
+	private boolean isRealType(Type type) {
+		return typeSystem.isSame(type, typeSystem.getType("real"));
 	}
 
-	private boolean isBooleanType(InferenceResult inferenceResult) {
-		if (inferenceResult.getType() == null) {
-			throw new IllegalArgumentException(inferenceResult.getIssues().iterator().next().getMessage());
-		}
-		return typeSystem.isBooleanType(inferenceResult.getType());
+	private boolean isBooleanType(Type type) {
+		return typeSystem.isSame(type, typeSystem.getType("boolean"));
 	}
 
-	private boolean isStringType(InferenceResult inferenceResult) {
-		if (inferenceResult.getType() == null) {
-			throw new IllegalArgumentException(inferenceResult.getIssues().iterator().next().getMessage());
-		}
-		return typeSystem.isStringType(inferenceResult.getType());
+	private boolean isStringType(Type type) {
+		return typeSystem.isSame(type, typeSystem.getType("string"));
 	}
 
-	private void expectIssue(InferenceResult inferenceResult, String message) {
-		if (inferenceResult == null) {
-			throw new IllegalArgumentException();
-		}
-		if (inferenceResult.getIssues().isEmpty()) {
+	private void expectIssue(Type object, String message) {
+		if (acceptor.getTraces(Severity.ERROR).isEmpty()) {
 			TestCase.fail("No issue detected.");
 		}
-		if (inferenceResult.getIssues().size() > 1) {
-			fail("Expected only one issue but detected " + inferenceResult.getIssues().size());
-		}
-		assertEquals(message, inferenceResult.getIssues().iterator().next().getMessage());
+		assertEquals(message, acceptor.getTraces(Severity.ERROR).iterator().next().getMessage());
 	}
 
 }

+ 14 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/util/STextRuntimeTestModule.java

@@ -11,7 +11,11 @@
 package org.yakindu.sct.model.stext.test.util;
 
 import org.eclipse.xtext.scoping.IScopeProvider;
+import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
+import org.yakindu.base.types.typesystem.DefaultTypeSystem;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.stext.STextRuntimeModule;
+import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 
 /**
  * 
@@ -25,4 +29,14 @@ public class STextRuntimeTestModule extends STextRuntimeModule {
 		return STextTestScopeProvider.class;
 	}
 	
+	@Override
+	public Class<? extends ITypeSystem> bindITypeSystem() {
+		return DefaultTypeSystem.class;
+	}
+	
+	@Override
+	public Class<? extends ITypeSystemInferrer> bindITypeSystemInferrer() {
+		return STextTypeInferrer.class;
+	}
+	
 }

+ 7 - 7
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/STextInterpreterTest.java

@@ -19,8 +19,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.base.types.ITypeSystem;
-import org.yakindu.base.types.InferredType;
+import org.yakindu.base.types.typesystem.DefaultTypeSystem;
+import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
 import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
@@ -473,35 +473,35 @@ public class STextInterpreterTest extends AbstractSTextTest {
 		ExecutionVariable intVar = new ExecutionVariableImpl();
 		intVar.setName("intVar");
 		intVar.setFqName("intVar");
-		intVar.setType(new InferredType(typeSystem.getIntegerType()));
+		intVar.setType(typeSystem.getType(DefaultTypeSystem.INTEGER));
 		intVar.setValue(0);
 		context.getSlots().add(intVar);
 
 		ExecutionVariable boolVar = new ExecutionVariableImpl();
 		boolVar.setName("boolVar");
 		boolVar.setFqName("boolVar");
-		boolVar.setType(new InferredType(typeSystem.getBooleanType()));
+		boolVar.setType(typeSystem.getType(DefaultTypeSystem.BOOLEAN));
 		boolVar.setValue(false);
 		context.getSlots().add(boolVar);
 
 		ExecutionVariable realVar = new ExecutionVariableImpl();
 		realVar.setName("realVar");
 		realVar.setFqName("realVar");
-		realVar.setType(new InferredType(typeSystem.getRealType()));
+		realVar.setType(typeSystem.getType(DefaultTypeSystem.REAL));
 		realVar.setValue(0.0f);
 		context.getSlots().add(realVar);
 
 		ExecutionVariable stringVar = new ExecutionVariableImpl();
 		stringVar.setName("stringVar");
 		stringVar.setFqName("stringVar");
-		stringVar.setType(new InferredType(typeSystem.getStringType()));
+		stringVar.setType(typeSystem.getType(DefaultTypeSystem.STRING));
 		stringVar.setValue("");
 		context.getSlots().add(stringVar);
 
 		ExecutionEvent event = new ExecutionEventImpl();
 		event.setName("abc");
 		event.setFqName("abc");
-		event.setType(new InferredType(typeSystem.getIntegerType()));
+		event.setType(typeSystem.getType(DefaultTypeSystem.INTEGER));
 		context.getSlots().add(event);
 	}