Opened 14 years ago
Last modified 14 years ago
#1371 closed defect (fixed)
Protected function arguments cause confusing error message
Reported by: | Per Östlund | Owned by: | Per Östlund |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Instantiation | Version: | trunk |
Keywords: | Cc: | Per Östlund, Martin Sjölund |
Description
When instantiating a model such as this:
function fn protected Real r; input Real inR; output Real outR; algorithm outR := inR; end fn; model test Real r, r2; equation r = fn(r2); end test;
the error message given is:
[protarg.mo:12:3-12:13:writable] Error: Failed to instantiate equation r = fn(r2);
The problem is that protected denotes a whole section and not a single variable, so the input and output parameters of the function is also protected. A protected input or output parameter doesn't really make much sense I think, but I can't see anything about it in the standard. We should probably print a warning either that you shouldn't protected input and output parameters, or an error that the number of arguments doesn't match the function definition.
Note:
See TracTickets
for help on using tickets.
I'll also add errors for functions containing equations.
Note: We can not make this an error because MSL uses public bidirectional variables even though they are not allowed in the specification.