Opened 14 years ago
Last modified 4 years ago
#1298 closed defect
Records (and functions) with complex default bindings fail — at Initial Version
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | critical | Milestone: | 1.16.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Martin Sjölund, Adrian Pop |
Description
Default bindings that refer to other input variables are not handled correctly. The only testcases that use these features work, but only because the binding is somehow ignored (using default modifications anyway).
{{{package HardMagnetic
public
constant Real mu_0 = 3;
record BaseData
parameter Real H_cBRef = 1;
parameter Real B_rRef = 1;
parameter Real T_ref = 293.15;
parameter Real alpha_Br = 0;
parameter Real T_op = 293.15;
final parameter Real B_r = B_rRef * (1 + alpha_Br * (T_op - T_ref));
final parameter Real H_cB = H_cBRef * (1 + alpha_Br * (T_op - T_ref));
final parameter Real mu_r = B_r / (mu_0 * H_cB);
end BaseData;
record NdFeB
extends HardMagnetic.BaseData(H_cBRef = 900000, B_rRef = 1.2, T_ref = 20 + 273.15, alpha_Br = -0.001);
end NdFeB;
end HardMagnetic;}}}
Can be handled while elaborating the call (for any parameter that needs a default binding, replace any cref to another input with the expression used for that input). Note that for functions, order matters so these bindings should be sorted already...