osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
36 stars 8 forks source link

Name resolution error for properties applied to connections #663

Closed yoogx closed 8 years ago

yoogx commented 8 years ago

Hi,

The following example triggers a bug in name resolution, see the XX marker below. A work around is to move the properties at a higher-level scope. But this breaks the symmetry of the models.

package bug_binding public

process A
features
    outp : out event port;
end A;

process B
features
    inp : in event port;
end B;

bus Bu end Bu;

system s end s;

system implementation s.impl
subcomponents
    procA : process a;
    procB : process b;
    bubus : bus bu;
connections
    c1 : port procA.outp -> procB.inp { Actual_Connection_Binding => reference (bubus);}; --  XXX error
end s.impl;

end bug_binding;

lwrage commented 8 years ago

Names in property associations written in {} after the declaration of an element are resolved in the context of this element and not in the context of the containing classifier. In the example, the name resolver looks for a something named bubus inside c1, which doesn't (and cannot) exist.

OSATE used to first look in the context of the declared element and then in the context of the containing classifier, but that isn't specified in the AADL standard so we removed it.

As a consequence, Actual_Connection_Binding must be a contained property association.

This has been reported several times, so it may be time to do something in the language specification to define the intended name resolution behavior if the declared element is not a subcomponent as in your example.

yoogx commented 8 years ago

Lutz, I agree you pointed the correct source of the bugs. But please provide a clear indication of where your resolution is compatible with the standard. For the moment, your patch simply breaks most of my models, most of AADLib, the models I share with others partners including Julien. For the moment, I have 220 bugs because of a change you introduced recently, a change that was not in previous releases of OSATE. IMHO, it would have been way better to enhance the standard

lwrage commented 8 years ago

This is a language issue so I'm assigning it to Peter.

reteprelief commented 8 years ago

I reread the standard. It states that things are resolved relative to the enclosing classifier. The exception is when the property is directly attached to a subcomponent (an element with a classifier). Connection declarations do not have classifiers thus should be resolved according to the original rule.

reteprelief commented 8 years ago

I have the correction but git refuses to let me push it out to Github. Will push it out when back in Pgh.

lwrage commented 8 years ago

The standard has different rules for the path in an applies to 11.3 (N7) and the path in a reference value 11.4 (N6). There is no exception for the reference value but there's a comment in my copy that adds the exception. My interpretation is that the following is what the standard defines.

system implementation S.i
  subcomponents
    b: bus;
    s: system X.i {Actual_Connection_Binding => reference(b);};
  connections
    c: ... {Actual_Connection_Binding => reference(b);};
end S.i;

If we treat both reference paths like applies to paths we'd have

system implementation S.i
  subcomponents
    b: bus;
    s: system X.i {Actual_Connection_Binding => reference(b);}; 
    -- No longer valid (unless X.i has a bus subcomponent named b)
  connections
    c: ... {Actual_Connection_Binding => reference(b);}; -- As before
end S.i;
reteprelief commented 8 years ago

All of the Aadlib examples compile ok with my fix. The standard 2.1 document with the errata has a statement in 11.4 (N6) regarding subcomponents. You can find the document with the change tracked errata on www.sae.org working documents, or in our group folder under \ad\dfs\Groups\SSD\ACVI\AADL Standard Work\aadlv2.1.