From df6ecef0e50da1bdc2787cdc14fe37645a0e80e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=96stlund?= Date: Mon, 4 Jun 2018 12:12:52 +0200 Subject: [PATCH] [NF] Use correct call attributes everywhere. - Use Call.makeTypedCall everywhere a typed call is created, so that the calls get the correct attributes. - Use correct variability for overloaded unary and binary operators. Belonging to [master]: - OpenModelica/OMCompiler#2491 --- Compiler/NFFrontEnd/NFBuiltinCall.mo | 72 +++++++---------------- Compiler/NFFrontEnd/NFCall.mo | 4 +- Compiler/NFFrontEnd/NFConnectEquations.mo | 6 +- Compiler/NFFrontEnd/NFExpression.mo | 6 +- Compiler/NFFrontEnd/NFTypeCheck.mo | 60 ++++++++++--------- Compiler/NFFrontEnd/NFTyping.mo | 10 ++-- 6 files changed, 67 insertions(+), 91 deletions(-) diff --git a/Compiler/NFFrontEnd/NFBuiltinCall.mo b/Compiler/NFFrontEnd/NFBuiltinCall.mo index 2433674e30..131d529a41 100644 --- a/Compiler/NFFrontEnd/NFBuiltinCall.mo +++ b/Compiler/NFFrontEnd/NFBuiltinCall.mo @@ -298,37 +298,9 @@ public // We have all except dimension n having equal sizes; with matching types ty := resTy; - callExp := Expression.CALL(makeCall2(NFBuiltinFuncs.CAT, Expression.INTEGER(n)::res, resTy, variability)); + callExp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.CAT, Expression.INTEGER(n)::res, variability, resTy)); end makeCatExp; - function makeCall - "Creates a call to a builtin function, given a Function and a list of - argument expressions." - input Function func; - input list args; - input Variability var; - output Call call; - algorithm - call := Call.TYPED_CALL(func, func.returnType, var, args, - CallAttributes.CALL_ATTR(func.returnType, false, true, false, false, - DAE.NO_INLINE(), DAE.NO_TAIL())); - end makeCall; - - function makeCall2 - "Creates a call to a builtin function, given a Function, list of argument - expressions and a return type. Used for builtin functions defined with no - return type." - input Function func; - input list args; - input Type returnType; - input Variability var; - output Call call; - algorithm - call := Call.TYPED_CALL(func, returnType, var, args, - CallAttributes.CALL_ATTR(returnType, false, true, false, false, - DAE.NO_INLINE(), DAE.NO_TAIL())); - end makeCall2; - protected function assertNoNamedParams input String fnName; @@ -432,13 +404,11 @@ protected end for; callExp := Expression.CALL( - Call.TYPED_CALL( + Call.makeTypedCall( matchedFunc.func, - outType, - var, list(Util.tuple31(a) for a in matchedFunc.args), - CallAttributes.CALL_ATTR(outType, false, false, false, false, DAE.NO_INLINE(),DAE.NO_TAIL())) - ); + var, + outType)); return; else Error.addSourceMessage(Error.AMBIGUOUS_MATCHING_FUNCTIONS_NFINST, @@ -564,7 +534,7 @@ protected end if; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, var, ty)); end typePreChangeCall; function typeDerCall @@ -611,7 +581,7 @@ protected end if; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeDerCall; function typeDiagonalCall @@ -653,7 +623,7 @@ protected end match; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeDiagonalCall; function typeEdgeCall @@ -783,7 +753,7 @@ protected end if; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg1, arg2}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg1, arg2}, var, ty)); end typeSmoothCall; function typeFillCall @@ -866,7 +836,7 @@ protected if variability <= Variability.STRUCTURAL_PARAMETER and intBitAnd(origin, ExpOrigin.FUNCTION) == 0 then callExp := Ceval.evalBuiltinFill(ty_args); else - callExp := Expression.CALL(makeCall2(NFBuiltinFuncs.FILL_FUNC, ty_args, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.FILL_FUNC, ty_args, variability, ty)); end if; end typeFillCall2; @@ -932,7 +902,7 @@ protected ty := Type.arrayElementType(ty); {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeScalarCall; function typeVectorCall @@ -986,7 +956,7 @@ protected ty := Type.ARRAY(Type.arrayElementType(ty), {Dimension.fromInteger(dim_size)}); {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeVectorCall; function typeMatrixCall @@ -1042,7 +1012,7 @@ protected ty := Type.ARRAY(Type.arrayElementType(ty), dims); {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeMatrixCall; function typeCatCall @@ -1125,7 +1095,7 @@ protected end if; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeSymmetricCall; function typeTransposeCall @@ -1168,7 +1138,7 @@ protected end match; {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeTransposeCall; function typeCardinalityCall @@ -1213,7 +1183,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.INTEGER(); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, var, ty)); // TODO: Check cardinality restrictions, 3.7.2.3. end typeCardinalityCall; @@ -1253,7 +1223,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.NORETCALL(); - callExp := Expression.CALL(makeCall2(fn, {arg1, arg2}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg1, arg2}, var, ty)); end typeBranchCall; function typeIsRootCall @@ -1288,7 +1258,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.BOOLEAN(); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, var, ty)); end typeIsRootCall; function typePotentialRootCall @@ -1351,7 +1321,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.NORETCALL(); - callExp := Expression.CALL(makeCall2(fn, {arg1, arg2}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg1, arg2}, var, ty)); end typePotentialRootCall; function typeRootCall @@ -1386,7 +1356,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.NORETCALL(); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, var, ty)); end typeRootCall; function typeRootedCall @@ -1421,7 +1391,7 @@ protected {fn} := Function.typeRefCache(fn_ref); ty := Type.BOOLEAN(); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, var)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, var, ty)); end typeRootedCall; function checkConnectionsArgument @@ -1497,7 +1467,7 @@ protected (arg, ty, variability) := Typing.typeExp(arg, intBitOr(origin, ExpOrigin.NOEVENT), info); {fn} := Function.typeRefCache(fn_ref); - callExp := Expression.CALL(makeCall2(fn, {arg}, ty, variability)); + callExp := Expression.CALL(Call.makeTypedCall(fn, {arg}, variability, ty)); end typeNoEventCall; function typeGetInstanceName diff --git a/Compiler/NFFrontEnd/NFCall.mo b/Compiler/NFFrontEnd/NFCall.mo index f0a03512a7..78999e37c0 100644 --- a/Compiler/NFFrontEnd/NFCall.mo +++ b/Compiler/NFFrontEnd/NFCall.mo @@ -275,8 +275,8 @@ uniontype Call function makeTypedCall input Function fn; input list args; - input Type returnType; input Variability variability; + input Type returnType = fn.returnType; output Call call; protected CallAttributes ca; @@ -357,7 +357,7 @@ uniontype Call ty := evaluateCallType(ty, func, args); end if; - call := makeTypedCall(func, args, ty, var); + call := makeTypedCall(func, args, var, ty); // If the matching was a vectorized one then create a map call // using the vectorization dim. This means going through each argument diff --git a/Compiler/NFFrontEnd/NFConnectEquations.mo b/Compiler/NFFrontEnd/NFConnectEquations.mo index 4362074d37..58255a856b 100644 --- a/Compiler/NFFrontEnd/NFConnectEquations.mo +++ b/Compiler/NFFrontEnd/NFConnectEquations.mo @@ -210,7 +210,7 @@ algorithm // Modelica doesn't allow == for Reals, so to keep the flat Modelica // somewhat valid we use 'abs(lhs - rhs) <= 0' instead. exp := Expression.BINARY(lhs_exp, Operator.makeSub(ty), rhs_exp); - exp := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.ABS_REAL, {exp}, Expression.variability(exp))); + exp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.ABS_REAL, {exp}, Expression.variability(exp))); exp := Expression.RELATION(exp, Operator.makeLessEq(ty), Expression.REAL(0.0)); else // For any other type, generate assertion for 'lhs == rhs'. @@ -510,7 +510,7 @@ function makeInStreamCall output Expression inStreamCall; annotation(__OpenModelica_EarlyInline = true); algorithm - inStreamCall := Expression.CALL(BuiltinCall.makeCall( + inStreamCall := Expression.CALL(Call.makeTypedCall( NFBuiltinFuncs.IN_STREAM, {streamExp}, Expression.variability(streamExp))); end makeInStreamCall; @@ -535,7 +535,7 @@ algorithm flow_threshold := flowThreshold; end if; - positiveMaxCall := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.POSITIVE_MAX_REAL, + positiveMaxCall := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.POSITIVE_MAX_REAL, {flowExp, flow_threshold}, Connector.variability(element))); setGlobalRoot(Global.isInStream, SOME(true)); diff --git a/Compiler/NFFrontEnd/NFExpression.mo b/Compiler/NFFrontEnd/NFExpression.mo index 430c86fe74..cd0f1aca86 100644 --- a/Compiler/NFFrontEnd/NFExpression.mo +++ b/Compiler/NFFrontEnd/NFExpression.mo @@ -3105,8 +3105,8 @@ public // An expression with array type, but which is not an array expression. // Such an expression can't be promoted here, so we create a promote call instead. case (_, _) guard isArray - then CALL(BuiltinCall.makeCall2( - NFBuiltinFuncs.PROMOTE, {exp, INTEGER(dims)}, listHead(types), variability(exp))); + then CALL(Call.makeTypedCall( + NFBuiltinFuncs.PROMOTE, {exp, INTEGER(dims)}, variability(exp), listHead(types))); // A scalar expression, promote it as many times as the number of types given. else @@ -3264,7 +3264,7 @@ public algorithm indexExp := match enumExp case ENUM_LITERAL() then INTEGER(enumExp.index); - else CALL(BuiltinCall.makeCall( + else CALL(Call.makeTypedCall( NFBuiltinFuncs.INTEGER_ENUM, {enumExp}, variability(enumExp))); end match; end enumIndexExp; diff --git a/Compiler/NFFrontEnd/NFTypeCheck.mo b/Compiler/NFFrontEnd/NFTypeCheck.mo index 5799909eb0..1d7b923ba2 100644 --- a/Compiler/NFFrontEnd/NFTypeCheck.mo +++ b/Compiler/NFFrontEnd/NFTypeCheck.mo @@ -138,16 +138,18 @@ end isValidPlugCompatibleMatch; function checkBinaryOperation input Expression exp1; input Type type1; + input Variability var1; input Operator operator; input Expression exp2; input Type type2; + input Variability var2; input SourceInfo info; output Expression binaryExp; output Type resultType; algorithm if Type.isComplex(Type.arrayElementType(type1)) or Type.isComplex(Type.arrayElementType(type2)) then - (binaryExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, operator, exp2, type2, info); + (binaryExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, var1, operator, exp2, type2, var2, info); else (binaryExp, resultType) := match operator.op case Op.ADD then checkBinaryOperationAdd(exp1, type1, exp2, type2, info); @@ -167,9 +169,11 @@ end checkBinaryOperation; public function checkBinaryOperationOperatorRecords input Expression inExp1; input Type inType1; + input Variability var1; input Operator inOp; input Expression inExp2; input Type inType2; + input Variability var2; input SourceInfo info; output Expression outExp; output Type outType; @@ -231,7 +235,7 @@ algorithm end if; candidates := listReverse(candidates); - args := {(inExp1,inType1,Variability.CONSTANT),(inExp2,inType2,Variability.CONSTANT)}; + args := {(inExp1,inType1,var1),(inExp2,inType2,var2)}; matchedFunctions := Function.matchFunctionsSilent(candidates, args, {}, info); // We only allow exact matches for operator overlaoding. e.g. no casting or generic matches. @@ -264,8 +268,8 @@ algorithm Call.makeTypedCall( matchedFunc.func, list(Util.tuple31(a) for a in matchedFunc.args), - outType, - Variability.CONSTANT)); + Prefixes.variabilityMax(var1, var2), + outType)); else Error.addSourceMessage(Error.AMBIGUOUS_MATCHING_OPERATOR_FUNCTIONS_NFINST, {Expression.toString(Expression.BINARY(inExp1, inOp, inExp2)) @@ -323,20 +327,15 @@ algorithm if listLength(matchedfuncs) == 1 then (operfn, {exp1,exp2}, var)::_ := matchedfuncs; - outType := Function.returnType(operfn); - outExp := Expression.CALL(Call.TYPED_CALL(operfn, outType, var, {exp1,exp2} - , CallAttributes.CALL_ATTR( - outType, false, false, false, false, DAE.NO_INLINE(),DAE.NO_TAIL()) - ) - ); - else + outType := Function.returnType(operfn); + outExp := Expression.CALL(Call.makeTypedCall(operfn, {exp1, exp2}, var, outType)); + else // TODO: FIX ME: Add proper error message. print("Ambiguous operator: " + "\nCandidates:\n "); print(Function.candidateFuncListString(list(Util.tuple31(fn) for fn in matchedfuncs))); print("\n"); fail(); end if; - end implicitConstructAndMatch; function checkValidBinaryOperatorOverload @@ -809,6 +808,7 @@ end checkBinaryOperationEW; public function checkUnaryOperation input Expression exp1; input Type type1; + input Variability var1; input Operator operator; input SourceInfo info; output Expression unaryExp; @@ -818,7 +818,7 @@ protected Operator op; algorithm if Type.isComplex(Type.arrayElementType(type1)) then - (unaryExp,unaryType) := checkUnaryOperationOperatorRecords(exp1, type1, operator, info); + (unaryExp,unaryType) := checkUnaryOperationOperatorRecords(exp1, type1, var1, operator, info); return; end if; @@ -838,6 +838,7 @@ end checkUnaryOperation; public function checkUnaryOperationOperatorRecords input Expression inExp1; input Type inType1; + input Variability var; input Operator inOp; input SourceInfo info; output Expression outExp; @@ -865,7 +866,7 @@ algorithm checkValidOperatorOverload(opstr, fn, node1); end for; - args := {(inExp1,inType1,Variability.CONSTANT)}; + args := {(inExp1,inType1,var)}; matchedFunctions := Function.matchFunctionsSilent(candidates, args, {}, info); // We only allow exact matches for operator overlaoding. e.g. no casting or generic matches. @@ -878,11 +879,12 @@ algorithm if listLength(exactMatches) == 1 then matchedFunc ::_ := exactMatches; outType := Function.returnType(matchedFunc.func); - outExp := Expression.CALL(Call.TYPED_CALL(matchedFunc.func, outType, Variability.CONSTANT, list(Util.tuple31(a) for a in matchedFunc.args) - , CallAttributes.CALL_ATTR( - outType, false, false, false, false, DAE.NO_INLINE(),DAE.NO_TAIL()) - ) - ); + outExp := Expression.CALL( + Call.makeTypedCall( + matchedFunc.func, + list(Util.tuple31(a) for a in matchedFunc.args), + var, + outType)); else Error.addSourceMessage(Error.AMBIGUOUS_MATCHING_OPERATOR_FUNCTIONS_NFINST, {Expression.toString(Expression.UNARY(inOp, inExp1)), @@ -895,9 +897,11 @@ end checkUnaryOperationOperatorRecords; function checkLogicalBinaryOperation input Expression exp1; input Type type1; + input Variability var1; input Operator operator; input Expression exp2; input Type type2; + input Variability var2; input SourceInfo info; output Expression outExp; output Type resultType; @@ -907,7 +911,7 @@ protected algorithm if Type.isComplex(Type.arrayElementType(type1)) or Type.isComplex(Type.arrayElementType(type2)) then - (outExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, operator, exp2, type2, info); + (outExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, var1, operator, exp2, type2, var2, info); return; end if; @@ -924,6 +928,7 @@ end checkLogicalBinaryOperation; function checkLogicalUnaryOperation input Expression exp1; input Type type1; + input Variability var1; input Operator operator; input SourceInfo info; output Expression outExp; @@ -932,9 +937,8 @@ protected Expression e1, e2; MatchKind mk; algorithm - if Type.isComplex(Type.arrayElementType(type1)) then - (outExp,resultType) := checkUnaryOperationOperatorRecords(exp1, type1, operator, info); + (outExp,resultType) := checkUnaryOperationOperatorRecords(exp1, type1, var1, operator, info); return; end if; @@ -948,9 +952,11 @@ end checkLogicalUnaryOperation; function checkRelationOperation input Expression exp1; input Type type1; + input Variability var1; input Operator operator; input Expression exp2; input Type type2; + input Variability var2; input ExpOrigin.Type origin; input SourceInfo info; output Expression outExp; @@ -965,7 +971,7 @@ algorithm if Type.isComplex(Type.arrayElementType(type1)) or Type.isComplex(Type.arrayElementType(type2)) then - (outExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, operator, exp2, type2, info); + (outExp,resultType) := checkBinaryOperationOperatorRecords(exp1, type1, var1, operator, exp2, type2, var2, info); return; end if; @@ -2008,11 +2014,11 @@ algorithm if isSome(stepExp) then SOME(step_exp) := stepExp; var := Prefixes.variabilityMax(var, Expression.variability(step_exp)); - dim_exp := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.DIV_INT, {dim_exp, step_exp}, var)); + dim_exp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.DIV_INT, {dim_exp, step_exp}, var)); end if; dim_exp := Expression.BINARY(dim_exp, Operator.makeSub(Type.INTEGER()), Expression.INTEGER(1)); - dim_exp := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.MAX_INT, {dim_exp}, var)); + dim_exp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.MAX_INT, {dim_exp}, var)); then Dimension.fromExp(dim_exp, var); @@ -2062,8 +2068,8 @@ algorithm dim_exp := Expression.BINARY(dim_exp, Operator.makeAdd(Type.REAL()), Expression.REAL(5e-15)); end if; - dim_exp := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.FLOOR, {dim_exp}, var)); - dim_exp := Expression.CALL(BuiltinCall.makeCall(NFBuiltinFuncs.INTEGER_REAL, {dim_exp}, var)); + dim_exp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.FLOOR, {dim_exp}, var)); + dim_exp := Expression.CALL(Call.makeTypedCall(NFBuiltinFuncs.INTEGER_REAL, {dim_exp}, var)); dim_exp := Expression.BINARY(dim_exp, Operator.makeAdd(Type.INTEGER()), Expression.INTEGER(1)); then Dimension.fromExp(dim_exp, var); diff --git a/Compiler/NFFrontEnd/NFTyping.mo b/Compiler/NFFrontEnd/NFTyping.mo index 3f4f585719..5dbc49d5b8 100644 --- a/Compiler/NFFrontEnd/NFTyping.mo +++ b/Compiler/NFFrontEnd/NFTyping.mo @@ -981,7 +981,7 @@ algorithm next_origin := intBitOr(origin, ExpOrigin.SUBEXPRESSION); (e1, ty1, var1) := typeExp(exp.exp1, next_origin, info); (e2, ty2, var2) := typeExp(exp.exp2, next_origin, info); - (exp, ty) := TypeCheck.checkBinaryOperation(e1, ty1, exp.operator, e2, ty2, info); + (exp, ty) := TypeCheck.checkBinaryOperation(e1, ty1, var1, exp.operator, e2, ty2, var2, info); then (exp, ty, Prefixes.variabilityMax(var1, var2)); @@ -989,7 +989,7 @@ algorithm algorithm next_origin := intBitOr(origin, ExpOrigin.SUBEXPRESSION); (e1, ty1, var1) := typeExp(exp.exp, next_origin, info); - (exp, ty) := TypeCheck.checkUnaryOperation(e1, ty1, exp.operator, info); + (exp, ty) := TypeCheck.checkUnaryOperation(e1, ty1, var1, exp.operator, info); then (exp, ty, var1); @@ -998,7 +998,7 @@ algorithm next_origin := intBitOr(origin, ExpOrigin.SUBEXPRESSION); (e1, ty1, var1) := typeExp(exp.exp1, next_origin, info); (e2, ty2, var2) := typeExp(exp.exp2, next_origin, info); - (exp, ty) := TypeCheck.checkLogicalBinaryOperation(e1, ty1, exp.operator, e2, ty2, info); + (exp, ty) := TypeCheck.checkLogicalBinaryOperation(e1, ty1, var1, exp.operator, e2, ty2, var2, info); then (exp, ty, Prefixes.variabilityMax(var1, var2)); @@ -1006,7 +1006,7 @@ algorithm algorithm next_origin := intBitOr(origin, ExpOrigin.SUBEXPRESSION); (e1, ty1, var1) := typeExp(exp.exp, next_origin, info); - (exp, ty) := TypeCheck.checkLogicalUnaryOperation(e1, ty1, exp.operator, info); + (exp, ty) := TypeCheck.checkLogicalUnaryOperation(e1, ty1, var1, exp.operator, info); then (exp, ty, var1); @@ -1015,7 +1015,7 @@ algorithm next_origin := intBitOr(origin, ExpOrigin.SUBEXPRESSION); (e1, ty1, var1) := typeExp(exp.exp1, next_origin, info); (e2, ty2, var2) := typeExp(exp.exp2, next_origin, info); - (exp, ty) := TypeCheck.checkRelationOperation(e1, ty1, exp.operator, e2, ty2, origin, info); + (exp, ty) := TypeCheck.checkRelationOperation(e1, ty1, var1, exp.operator, e2, ty2, var2, origin, info); variability := Prefixes.variabilityMax(var1, var2); // A relation involving continuous expressions which is not inside