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#2957 - OpenModelica/OpenModelica-testsuite#1130
- Loading branch information
1 parent
1c477aa
commit 31dd020
Showing
10 changed files
with
164 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// name: BindingInvalidType1 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model BindingInvalidType1 | ||
Real x = "wrong"; | ||
end BindingInvalidType1; | ||
|
||
// Result: | ||
// Error processing file: BindingInvalidType1.mo | ||
// [flattening/modelica/scodeinst/BindingInvalidType1.mo:8:3-8:19:writable] Error: Type mismatch in binding x = "wrong", expected subtype of Real, got type String. | ||
// | ||
// # 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,19 @@ | ||
// name: BindingInvalidType2 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model BindingInvalidType2 | ||
Real x = {1, 2, 3}; | ||
end BindingInvalidType2; | ||
|
||
// Result: | ||
// Error processing file: BindingInvalidType2.mo | ||
// [flattening/modelica/scodeinst/BindingInvalidType2.mo:8:3-8:21:writable] Error: Type mismatch in binding ‘x = {1, 2, 3}‘, expected array dimensions [], got [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,19 @@ | ||
// name: BindingInvalidType3 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model BindingInvalidType3 | ||
Real x[3] = {1, 2}; | ||
end BindingInvalidType3; | ||
|
||
// Result: | ||
// Error processing file: BindingInvalidType3.mo | ||
// [flattening/modelica/scodeinst/BindingInvalidType3.mo:8:3-8:21:writable] Error: Type mismatch in binding ‘x = {1, 2}‘, expected array dimensions [3], got [2]. | ||
// | ||
// # 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,19 @@ | ||
// name: BindingInvalidType4 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model BindingInvalidType4 | ||
Real x[3] = 1; | ||
end BindingInvalidType4; | ||
|
||
// Result: | ||
// Error processing file: BindingInvalidType4.mo | ||
// [flattening/modelica/scodeinst/BindingInvalidType4.mo:8:3-8:16:writable] Error: Non-array modification ‘1‘ for array component ‘x‘, possibly due to missing ‘each‘. | ||
// | ||
// # 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,19 @@ | ||
// name: BindingInvalidType5 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model BindingInvalidType5 | ||
Real x[3] = {"1", "2", "3"}; | ||
end BindingInvalidType5; | ||
|
||
// Result: | ||
// Error processing file: BindingInvalidType5.mo | ||
// [flattening/modelica/scodeinst/BindingInvalidType5.mo:8:3-8:30:writable] Error: Type mismatch in binding x = {"1", "2", "3"}, expected subtype of Real[3], got type String[3]. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// endResult |
28 changes: 28 additions & 0 deletions
28
flattening/modelica/scodeinst/CardinalityInvalidContext1.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,28 @@ | ||
// name: CardinalityInvalidContext1 | ||
// keywords: cardinality | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Cardinality may only be used in the conditions of if-statements/equations and | ||
// asserts. | ||
// | ||
|
||
connector C | ||
Real e; | ||
flow Real f; | ||
end C; | ||
|
||
model CardinalityInvalidContext1 | ||
C c; | ||
Integer n = cardinality(c); | ||
end CardinalityInvalidContext1; | ||
|
||
// Result: | ||
// Error processing file: CardinalityInvalidContext1.mo | ||
// [flattening/modelica/scodeinst/CardinalityInvalidContext1.mo:17:3-17:29:writable] Error: cardinality may only be used in the condition of an if-statement/equation or an assert. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// endResult |
32 changes: 32 additions & 0 deletions
32
flattening/modelica/scodeinst/CardinalityInvalidContext2.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: CardinalityInvalidContext2 | ||
// keywords: cardinality | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Cardinality may only be used in the conditions of if-statements/equations and | ||
// asserts. | ||
// | ||
|
||
connector C | ||
Real e; | ||
flow Real f; | ||
end C; | ||
|
||
model CardinalityInvalidContext2 | ||
C c; | ||
Integer n; | ||
equation | ||
if time > 0 then | ||
n = cardinality(c); | ||
end if; | ||
end CardinalityInvalidContext2; | ||
|
||
// Result: | ||
// Error processing file: CardinalityInvalidContext2.mo | ||
// [flattening/modelica/scodeinst/CardinalityInvalidContext2.mo:20:5-20:23:writable] Error: cardinality may only be used in the condition of an if-statement/equation or an assert. | ||
// | ||
// # 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
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