diff --git a/Compiler/BackEnd/BackendDAECreate.mo b/Compiler/BackEnd/BackendDAECreate.mo index 86737a7653..129e082bef 100644 --- a/Compiler/BackEnd/BackendDAECreate.mo +++ b/Compiler/BackEnd/BackendDAECreate.mo @@ -865,7 +865,7 @@ algorithm comment = comment, innerOuter = io) equation - kind_1 = lowerKnownVarkind(kind, name, dir, ct); + kind_1 = lowerKnownVarkind(kind, t, name, dir, ct); // bind = fixParameterStartBinding(bind, t, dae_var_attr, kind_1); tp = lowerType(t); b = DAEUtil.boolVarVisibility(protection); @@ -1094,6 +1094,7 @@ algorithm match (inVarKind, inType) case (DAE.VARIABLE(), DAE.T_BOOL()) then BackendDAE.DISCRETE(); case (DAE.VARIABLE(), DAE.T_INTEGER()) then BackendDAE.DISCRETE(); + case (DAE.VARIABLE(), DAE.T_STRING()) then BackendDAE.DISCRETE(); case (DAE.VARIABLE(), DAE.T_ENUMERATION()) then BackendDAE.DISCRETE(); case (DAE.VARIABLE(), _) then BackendDAE.VARIABLE(); case (DAE.DISCRETE(), _) then BackendDAE.DISCRETE(); @@ -1105,6 +1106,7 @@ protected function lowerKnownVarkind "Helper function to lowerKnownVar. NOTE: Fails for everything but parameters and constants and top level inputs" input DAE.VarKind inVarKind; + input DAE.Type inType; input DAE.ComponentRef inComponentRef; input DAE.VarDirection inVarDirection; input DAE.ConnectorType inConnectorType; @@ -1118,7 +1120,15 @@ algorithm equation true = DAEUtil.topLevelInput(inComponentRef, inVarDirection, inConnectorType); then - BackendDAE.VARIABLE(); + match (inVarKind, inType) + case (DAE.VARIABLE(), DAE.T_BOOL()) then BackendDAE.DISCRETE(); + case (DAE.VARIABLE(), DAE.T_INTEGER()) then BackendDAE.DISCRETE(); + case (DAE.VARIABLE(), DAE.T_STRING()) then BackendDAE.DISCRETE(); + case (DAE.VARIABLE(), DAE.T_ENUMERATION()) then BackendDAE.DISCRETE(); + case (DAE.VARIABLE(), _) then BackendDAE.VARIABLE(); + case (DAE.DISCRETE(), _) then BackendDAE.DISCRETE(); + end match; + // adrpo: topLevelInput might fail! // case (DAE.VARIABLE(), cr, dir, flowPrefix) // then