Opened 10 years ago

Closed 7 years ago

#3203 closed defect (fixed)

Lookup fails for partial function application and component modifier redeclare

Reported by: Henrik Tidefelt Owned by: Per Östlund
Priority: blocker Milestone: 2.0.0
Component: New Instantiation Version: trunk
Keywords: Cc:

Description

Validate TestFailing in the package below:

package ComponentModRedeclare
  partial function funcBase
    output Real y;
  end funcBase;

  function funcDerived
    extends funcBase;
    input Real x;
  algorithm
    y := x;
  end funcDerived;

  partial model Base
    replaceable function foo = funcBase;
  end Base;

  model Derived
    extends Base;
    Real y;
  equation
    y = foo();
  end Derived;

  model TestWorking
    Derived derived(redeclare function foo = funcDerived(x = 1));
    Real notConstant(start = 1);
  equation
    der(notConstant) = -notConstant;
  end TestWorking;

  model TestFailing
    Derived derived(redeclare function foo = funcDerived(x = notConstant));
    Real notConstant(start = 1);
  equation
    der(notConstant) = -notConstant;
  end TestFailing;
end ComponentModRedeclare;

This results in

[ComponentModRedeclare:39:58-39:76:writable] Error: Variable notConstant not found in scope ComponentModRedeclare.Derived$derived.
[ComponentModRedeclare:28:5-28:16:writable] Error: Class foo not found in scope ComponentModRedeclare.Derived$derived (looking for a function or record).
Error: Error occurred while flattening model ComponentModRedeclare.TestFailing

whereas the model TestWorking validates fine.

The only difference between TestFailing and TestWorking is the variability of the expression used in the modification for x.

Change History (4)

comment:1 by Adrian Pop, 10 years ago

Similar to #2660 and #3077.
Currently we need a constant binding for the component used for modification.

comment:2 by Francesco Casella, 7 years ago

Component: *unknown*NF - New FrontEnd
Milestone: Future2.0.0
Owner: changed from somebody to Per Östlund
Priority: highblocker
Status: newassigned

@perost, please check this works fine with newInst

comment:3 by Per Östlund, 7 years ago

Component: NF - New FrontEndNew Instantiation

Move all tickets from NF - New Frontend to New Instantiation so we don't have two different categories for the same thing.

comment:4 by Francesco Casella, 7 years ago

Resolution: fixed
Status: assignedclosed

The model TestFailing now works as expected with the new front-end. This is currently activated by -d=newInst, but it will become the default in 2.0.0, so I close this ticket with that milestone.

Note: See TracTickets for help on using tickets.