Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2121 closed defect (fixed)

OMC can't load invalid packages

Reported by: Per Östlund Owned by: somebody
Priority: high Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc: Adrian Pop, Martin Sjölund

Description

I've added a couple of tests to the compliance library, but OMC can't even load the library since it triggers errors for double declarations and type names of components being the same as the components name. Such errors should not be triggered during loading but when the relevant models are instantiated.

Change History (8)

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

For your API that tests a given file, you need to instead use something like:

testThisFile("abc.mo");

Or only ask to get the annotation in that file in case it did not parse (custom parser that skips Absyn->SCode, for code that should never be part of the Program).

shouldThisFileHaveFailed("abc.mo");

comment:2 by Per Östlund, 12 years ago

Resolution: fixed
Status: newclosed

These are not syntax errors, so the compiler should be able to load them in my opinion. Checking for these things in SCodeUtil seems to me to be arbitrary and unnecessary. I've removed the checks from SCodeUtil in r15551, since they are anyway checked later in a better way. As a bonus you can now also load and fix such models in OMEdit, even though OMEdit should have been able to do so anyway.

comment:3 by Adrian Pop, 12 years ago

I also agree with this even if we might loose some very strong early checks.
We should always be able to load things that are syntactically correct.

Last edited 12 years ago by Adrian Pop (previous) (diff)

comment:4 by Adrian Pop, 12 years ago

I recon this line:

 _ := SCodeUtil.translateAbsyn2SCode(outProgram);

is not needed anymore in Parser.mo then.

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

Aren't there more things that are enforced in Absyn->SCode though?

comment:6 by Per Östlund, 12 years ago

From what I can see it checks for subscripted modifiers, which is a syntax error. It also checks for connects in initial equation sections, which isn't. So that check should also be moved to later. Otherwise it only seems to check for "impossible" things, like components that are both flow and stream at the same time.

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

Hmmmm... Are subscripted modifiers really a syntax error? I guess I should check the grammar then.

comment:8 by Per Östlund, 12 years ago

Yes, they are forbidden by the grammar. I chose to check it in SCodeUtil though, since that was easiest. If you want to move the check to the parser then that's fine with me.

Note: See TracTickets for help on using tickets.