Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #8296
- Loading branch information
Showing
8 changed files
with
112 additions
and
2 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
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
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
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
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
42 changes: 42 additions & 0 deletions
42
testsuite/flattening/modelica/scodeinst/FuncBuiltinPure1.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,42 @@ | ||
// name: FuncBuiltinPure1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
impure function f | ||
input Real x; | ||
output Real y = x; | ||
end f; | ||
|
||
function f2 | ||
input Real x; | ||
output Real y; | ||
algorithm | ||
y := pure(f(x)); | ||
end f2; | ||
|
||
model FuncBuiltinPure1 | ||
Real x = f2(time); | ||
Real y = pure(f(time)); | ||
end FuncBuiltinPure1; | ||
|
||
// Result: | ||
// impure function f | ||
// input Real x; | ||
// output Real y = x; | ||
// end f; | ||
// | ||
// function f2 | ||
// input Real x; | ||
// output Real y; | ||
// algorithm | ||
// y := f(x); | ||
// end f2; | ||
// | ||
// class FuncBuiltinPure1 | ||
// Real x = f2(time); | ||
// Real y = f(time); | ||
// end FuncBuiltinPure1; | ||
// endResult |
20 changes: 20 additions & 0 deletions
20
testsuite/flattening/modelica/scodeinst/FuncBuiltinPure2.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,20 @@ | ||
// name: FuncBuiltinPure2 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model FuncBuiltinPure2 | ||
Real x = pure(1.0); | ||
end FuncBuiltinPure2; | ||
|
||
// Result: | ||
// Error processing file: FuncBuiltinPure2.mo | ||
// [flattening/modelica/scodeinst/FuncBuiltinPure2.mo:9:3-9:21:writable] Error: The argument to ‘pure‘ must be a function call expression. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// 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