@@ -623,7 +623,7 @@ algorithm
623623
624624 case Expression . ARRAY () then typeArray(exp. elements, info);
625625 case Expression . RANGE () then typeRange(exp, info);
626- case Expression . TUPLE () then typeTuple(exp. elements, info);
626+ case Expression . TUPLE () then typeTuple(exp. elements, info, origin );
627627 case Expression . SIZE () then typeSize(exp, info);
628628 case Expression . END () then typeEnd(origin, info);
629629
@@ -1066,6 +1066,7 @@ end typeRange;
10661066function typeTuple
10671067 input list< Expression > elements;
10681068 input SourceInfo info;
1069+ input ExpOrigin origin;
10691070 output Expression tupleExp;
10701071 output Type tupleType;
10711072 output Variability variability;
@@ -1074,6 +1075,16 @@ protected
10741075 list< Type > tyl;
10751076 list< Variability > valr;
10761077algorithm
1078+ () := match origin
1079+ case ExpOrigin . LHS () then ();
1080+ else
1081+ algorithm
1082+ Error . addSourceMessage(Error . RHS_TUPLE_EXPRESSION ,
1083+ {Expression . toString(Expression . TUPLE (Type . UNKNOWN (), elements))}, info);
1084+ then
1085+ fail();
1086+ end match;
1087+
10771088 (expl, tyl, valr) := typeExpl(elements, info);
10781089 tupleType := Type . TUPLE (tyl, NONE ());
10791090 tupleExp := Expression . TUPLE (tupleType, expl);
0 commit comments