Opened 13 years ago

Closed 7 years ago

#1736 closed defect (fixed)

Undeclared components in if equation's false branch are not checked

Reported by: Peter Aronsson Owned by: Martin Sjölund
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc: Peter Aronsson

Description (last modified by Martin Sjölund)

The following model doesn't produce any error message when checking (v1.8.0).

model test
  parameter Boolean bool=false;
  Real x;
equation 
  if bool then
    der(x)=B;
  else
    der(x)=4;
  end if;
end test;

It should report an error that B is undeclared!

Attachments (2)

InstSection.patch (11.8 KB ) - added by Martin Sjölund 12 years ago.
InstSection.2.patch (21.2 KB ) - added by Martin Sjölund 12 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Martin Sjölund, 12 years ago

Cc: petar, → petar
Description: modified (diff)
Owner: changed from Peter Aronsson to Martin Sjölund
Status: newaccepted

I know for a fact that illegal expressions are in parameter-false branches in some versions of MSL. Since we support different language standards in flags, maybe we can disable this for Modelica 3. I will run the testsuite and see.

comment:2 by Martin Sjölund, 12 years ago

Milestone: 1.9.0

by Martin Sjölund, 12 years ago

Attachment: InstSection.patch added

comment:3 by Martin Sjölund, 12 years ago

Ok, I was thinking about if-expressions. But I tried it on if-equations like the ticket says and...

The patch conflicts with connection graph (isRoot) because the cg needs to be discarded if it cannot be selected. So back to the drawing board.

comment:4 by Martin Sjölund, 12 years ago

Ok, got something running, but all testcases that use if-equations need to be updated so it will be something for tomrrow.

comment:5 by Martin Sjölund, 12 years ago

And MSL 2.2.1 keeps illegal connections in unreachable branches. Great, another thing to hack through :)

by Martin Sjölund, 12 years ago

Attachment: InstSection.2.patch added

comment:6 by Martin Sjölund, 12 years ago

Milestone: 1.9.0Future

I give up. There are more important things to fix. Whatever you do, some other model breaks, equalityconstraints, etc :(

comment:7 by Martin Sjölund, 7 years ago

Component: InstantiationNew Instantiation

This will be fixed in the new instantiation

comment:8 by Francesco Casella, 7 years ago

Milestone: Future2.0.0
Resolution: fixed
Status: acceptedclosed

The new front end now correctly fails with this error:

[1] 18:41:45 Translation Error
[test: 6:5-6:13]: Variable B not found in scope test.

The new FE is currently activated by -d=newInst, but it will become the default in 2.0.0, so I am closing this ticket with that milestone.

Note: See TracTickets for help on using tickets.