﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4134	The uses annotation is not interpreted according to the Modelica specification	Francesco Casella	somebody	"Consider the following test package:
{{{
package A
  model B
    Real x;
    function f
      input Real x;
      output Real y;
    algorithm
      y:= 2*x;
      annotation(uses(Modelica(version=""3.1"")));
    end f;
  equation
    x = f(time);
    annotation(uses(Modelica(version=""3.2.1"")));
  end B;
  annotation(uses(Modelica(version=""3.2.2"")));
end A;

checkModel(A.B); getErrorString();
simulate(A.B); getErrorString();
}}}

OMC loads the Modelica Standard Library 3.2.1, with its dependencies. This is wrong, as the Modelica specification (since 2.2) states that
  In a top-level class, the version number and the dependency to earlier versions of this class are defined using one or more of the following annotations

Therefore, in the above example, the correct version to be loaded should be 3.2.2.

I would also strongly suggest that the compiler issued warnings whenever it encounters version, conversion, and uses annotations in places others than a top-level class. In this case, I would expect something like:

  Warning: A.mo line 9: incorrect uses annotation defined in non top-level class
  Warning: A.mo line 12: incorrect uses annotation defined in non top-level-class
"	defect	closed	blocker	2.0.0	Frontend		fixed		Martin Sjölund
