#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 , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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 , 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.
comment:4 by , 12 years ago
I recon this line:
_ := SCodeUtil.translateAbsyn2SCode(outProgram);
is not needed anymore in Parser.mo then.
comment:6 by , 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 , 12 years ago
Hmmmm... Are subscripted modifiers really a syntax error? I guess I should check the grammar then.
comment:8 by , 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.
For your API that tests a given file, you need to instead use something like:
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).