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 )
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)
Change History (10)
comment:1 by , 13 years ago
| Cc: | petar, → petar |
|---|---|
| Description: | modified (diff) |
| Owner: | changed from to |
| Status: | new → accepted |
comment:2 by , 13 years ago
| Milestone: | → 1.9.0 |
|---|
by , 13 years ago
| Attachment: | InstSection.patch added |
|---|
comment:3 by , 13 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 , 13 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 , 13 years ago
And MSL 2.2.1 keeps illegal connections in unreachable branches. Great, another thing to hack through :)
by , 13 years ago
| Attachment: | InstSection.2.patch added |
|---|
comment:6 by , 13 years ago
| Milestone: | 1.9.0 → Future |
|---|
I give up. There are more important things to fix. Whatever you do, some other model breaks, equalityconstraints, etc :(
comment:7 by , 8 years ago
| Component: | Instantiation → New Instantiation |
|---|
This will be fixed in the new instantiation
comment:8 by , 7 years ago
| Milestone: | Future → 2.0.0 |
|---|---|
| Resolution: | → fixed |
| Status: | accepted → closed |
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.

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.