﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4905	Restriction on input connection is not enforced by OMC	Francesco Casella	Per Östlund	"Please consider the following test package (also attached)
{{{
package TestProtectedConnector
  model M
    Modelica.Blocks.Interfaces.RealInput u if use_u;
    parameter Boolean use_u;
  // protected
    Modelica.Blocks.Interfaces.RealInput u_internal;
  equation
    if not use_u then
      u_internal = 1;
    end if;
    connect(u, u_internal);
  end M;

  model P
    TestProtectedConnector.M m1(use_u = true);
    TestProtectedConnector.M m2(use_u = false);
    Modelica.Blocks.Sources.RealExpression source;
  equation
    connect(source.y, m1.u);
  end P;
end TestProtectedConnector;
}}}

Model P is illegal, because it violates the rule stated in section 9.3 of the specification

  A connection set of causal variables (input / output) may at most contain variables from one inside output connector or one public outside  input connector.

With the old FE, a warning is issued
{{{
[TestProtectedConnector: 11:5-11:27]: 
Connecting two signal sources while connecting u to u_internal.
}}}
while the new FE silently accepts this code.

Other tools fail to compile the model, because it does not comply with the specification.

IMO this test case should generate an error also in OMC, accepting illegal Modelica code encourages bad modelling practices and hinders tool portability. We may add one flag to optionally lift this restriction, but it shouldn't be the default behaviour."	defect	assigned	high	2.1.0	New Instantiation				
