Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NF] Fix variability of array() and reductions.
- Take the variability of the argument expression in array constructors and reductions into account when determining the overall variability, and not only the variability of the range expressions.
- Loading branch information
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
testsuite/flattening/modelica/scodeinst/ArrayConstructorComplex1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// name: ArrayConstructorComplex1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
operator record Complex "Complex number with overloaded operators" | ||
replaceable Real re "Real part of complex number"; | ||
replaceable Real im "Imaginary part of complex number"; | ||
end Complex; | ||
|
||
model ArrayConstructorComplex1 | ||
Complex[3] u; | ||
Complex[3] uInternal = {if false then u[k] else u[k] for k in 1:3}; | ||
end ArrayConstructorComplex1; | ||
|
||
// Result: | ||
// class ArrayConstructorComplex1 | ||
// Real u[1].re "Real part of complex number"; | ||
// Real u[1].im "Imaginary part of complex number"; | ||
// Real u[2].re "Real part of complex number"; | ||
// Real u[2].im "Imaginary part of complex number"; | ||
// Real u[3].re "Real part of complex number"; | ||
// Real u[3].im "Imaginary part of complex number"; | ||
// Real uInternal[1].re = u[1].re "Real part of complex number"; | ||
// Real uInternal[1].im = u[1].im "Imaginary part of complex number"; | ||
// Real uInternal[2].re = u[2].re "Real part of complex number"; | ||
// Real uInternal[2].im = u[2].im "Imaginary part of complex number"; | ||
// Real uInternal[3].re = u[3].re "Real part of complex number"; | ||
// Real uInternal[3].im = u[3].im "Imaginary part of complex number"; | ||
// end ArrayConstructorComplex1; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters