Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OMCompiler#2342 - OpenModelica/OpenModelica-testsuite#914
- Loading branch information
1 parent
7257817
commit fde17ad
Showing
8 changed files
with
117 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// name: IfExpression1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression1 | ||
Real x = if true then 1 else 2; | ||
end IfExpression1; | ||
|
||
// Result: | ||
// class IfExpression1 | ||
// Real x = 1.0; | ||
// end IfExpression1; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// name: IfExpression2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression2 | ||
Real x = if time > 1 then 1 else 2; | ||
end IfExpression2; | ||
|
||
// Result: | ||
// class IfExpression2 | ||
// Real x = /*Real*/(if time > 1.0 then 1 else 2); | ||
// end IfExpression2; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// name: IfExpression3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression3 | ||
parameter Boolean b = true; | ||
Real x = if b then 1 else 2; | ||
end IfExpression3; | ||
|
||
// Result: | ||
// class IfExpression3 | ||
// parameter Boolean b = true; | ||
// Real x = /*Real*/(if b then 1 else 2); | ||
// end IfExpression3; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// name: IfExpression4 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression4 | ||
parameter Boolean b = true; | ||
Real x[2] = if b then {1, 2} else {3, 4, 5}; | ||
end IfExpression4; | ||
|
||
// Result: | ||
// class IfExpression4 | ||
// parameter Boolean b = true; | ||
// Real x[1]; | ||
// Real x[2]; | ||
// equation | ||
// x = {1.0, 2.0}; | ||
// end IfExpression4; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// name: IfExpression5 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression5 | ||
Real x[2] = if time > 1 then {1, 2} else {3, 4, 5}; | ||
end IfExpression5; | ||
|
||
// Result: | ||
// Error processing file: IfExpression5.mo | ||
// [flattening/modelica/scodeinst/IfExpression5.mo:8:3-8:53:writable] Error: Type mismatch in if-expression in component . True branch: {1, 2} has type Integer[2], false branch: {3, 4, 5} has type Integer[3]. | ||
// | ||
// # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// name: IfExpression6 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model M | ||
parameter Boolean b; | ||
Real x[if b then 2 else 3] = if b then {1, 2} else {3, 4, 5}; | ||
end M; | ||
|
||
model IfExpression6 | ||
M m[2](b = {true, false}); | ||
end IfExpression6; | ||
|
||
// Result: | ||
// class IfExpression4 | ||
// parameter Boolean b = true; | ||
// Real x[1]; | ||
// Real x[2]; | ||
// equation | ||
// x = {1.0, 2.0}; | ||
// end IfExpression4; | ||
// 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
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