Opened 16 years ago
Last modified 14 years ago
#1059 closed defect (invalid)
Illegal Modelica code is allowed (vectorized expression output from functions) (from MathCore)
Reported by: | krsta | Owned by: | krsta |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | krsta, |
Description
The following class is illegal according to Modelica since it contains expressions on left-hand side of the vectorized function output. There is a message that it is not supported when building but building is successfully and a (correct) result is returned.
class EqualityEquations Real x,y,z; function f input Real u; input Real v; output Real y[3]; algorithm y:={u+v,u-v,u*v}; end f; equation {x+1, y, 1/z} = f(1.0, 2.0); // Illegal! // Not a list of variables // on the left-hand side end EqualityEquations;
Change History (2)
comment:1 by , 15 years ago
comment:2 by , 14 years ago
This is actually supposed to be legal.
The specification says there are two equality equations:
non-tuple Expression = Expression -or- Tuple of cref = FunctionCall
I added a check for tuple of cref in the trunk, so that is now checked. If you have seen somewhere else that it also is illegal for arrays, re-open the bug and post the MSL section.
http://intranet/trac/mathmodelica/ticket/1098