Changes between Version 4 and Version 5 of Ticket #3450


Ignore:
Timestamp:
2015-09-10T06:46:08Z (10 years ago)
Author:
Henrik Tidefelt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3450 – Description

    v4 v5  
    1 Running the ExampleModel from the package below will yield the following error:
    2 
    3   15:55:39 Translation Error
    4   [CTest: 9:47-9:80]: Cykliskt beroende konstanter eller parametrar hittades i definitionsomr�de : {x}.
    5 
    6 or translated to english..
     1Validation of `P.M` in the package below yields the following error in the message browser (but also reports the validation as successful):
    72
    83   Error: Cyclically dependent constants or parameters found in scope : {x}.
    94
    10 In the ambient model, changing the modifier x=x in the redeclaration of the function to x=5 will resolve the error. However those two statements should be equivalent.
     5In the `Base` model, changing the modifier x=x in the redeclaration of the function to x=5 will resolve the error. However those two statements should be equivalent.
    116
    127Package:
    138{{{
    14 package CTest
     9package P
    1510
    16   model ExampleModel
    17     Component component;
    18     inner Ambient ambient;
    19   end ExampleModel;
    20 
    21   model Ambient
    22     extends CTest.AmbientBase(redeclare final function func = CTest.func(x = x));
    23     parameter Real x = 5;
    24   end Ambient;
    25 
    26   partial model AmbientBase
    27     replaceable partial function func = CTest.func;
    28     parameter Real var_value = 2;
    29   end AmbientBase;
    30 
    31   model Component
    32     outer Ambient ambient;
    33     parameter Real var = ambient.func(ambient.var_value);
    34     Real z;
    35   equation
    36     z = var;
    37   end Component;
    38 
    39   function func
     11  function f
    4012    input Real x;
    4113    output Real y;
    4214  algorithm
    4315    y := x + 2;
    44   end func;
     16  end f;
    4517
    46 end CTest;
     18  partial model Base
     19    replaceable partial function func = f;
     20  end Base;
     21
     22  model M
     23    extends Base(redeclare final function func = f(x = x));
     24    parameter Real x = 5;
     25    Real y = func(1);
     26  end M;
     27
     28end P;
    4729}}}