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#1982 - OpenModelica/OpenModelica-testsuite#765
- Loading branch information
1 parent
7046ded
commit d2feef9
Showing
8 changed files
with
171 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
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: ExtendsVisibility4 | ||
// keywords: extends visibility | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model A | ||
function f | ||
output Real x = 1.0; | ||
end f; | ||
end A; | ||
|
||
model B | ||
protected | ||
extends A; | ||
end B; | ||
|
||
model ExtendsVisibility4 | ||
Real x = b.f(); | ||
B b; | ||
end ExtendsVisibility4; | ||
|
||
// Result: | ||
// Error processing file: ExtendsVisibility4.mo | ||
// [flattening/modelica/scodeinst/ExtendsVisibility4.mo:8:3-10:8:writable] Error: Illegal access of protected element f. | ||
// [flattening/modelica/scodeinst/ExtendsVisibility4.mo:19:3-19:17:writable] Error: Variable b.f not found in scope ExtendsVisibility4. | ||
// | ||
// # 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,36 @@ | ||
// name: ExtendsVisibility5 | ||
// keywords: extends visibility | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model A | ||
function f | ||
output Real x = 1.0; | ||
end f; | ||
end A; | ||
|
||
model B | ||
protected | ||
extends A; | ||
end B; | ||
|
||
model C | ||
extends A; | ||
end C; | ||
|
||
model ExtendsVisibility5 | ||
Real x = c.f(); | ||
C c; | ||
B b; | ||
end ExtendsVisibility5; | ||
|
||
// Result: | ||
// function c.f | ||
// output Real x = 1.0; | ||
// end c.f; | ||
// | ||
// class ExtendsVisibility5 | ||
// Real x = c.f(); | ||
// end ExtendsVisibility5; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// name: Visibility1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model Visibility1 | ||
Real x; | ||
protected | ||
Real y; | ||
equation | ||
y = x; | ||
end Visibility1; | ||
|
||
// Result: | ||
// class Visibility1 | ||
// Real x; | ||
// protected Real y; | ||
// equation | ||
// y = x; | ||
// end Visibility1; | ||
// 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,22 @@ | ||
// name: Visibility2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model A | ||
Real x; | ||
end A; | ||
|
||
model Visibility2 | ||
Real x = a.x; | ||
protected | ||
A a; | ||
end Visibility2; | ||
|
||
// Result: | ||
// class Visibility2 | ||
// Real x = a.x; | ||
// Real a.x; | ||
// end Visibility2; | ||
// 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,25 @@ | ||
// name: Visibility3 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model A | ||
protected Real x; | ||
end A; | ||
|
||
model Visibility3 | ||
Real x = a.x; | ||
A a; | ||
end Visibility3; | ||
|
||
// Result: | ||
// Error processing file: Visibility3.mo | ||
// [flattening/modelica/scodeinst/Visibility3.mo:8:13-8:19:writable] Error: Illegal access of protected element x. | ||
// [flattening/modelica/scodeinst/Visibility3.mo:12:3-12:15:writable] Error: Variable a.x not found in scope Visibility3. | ||
// | ||
// # 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,27 @@ | ||
// name: Visibility4 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
model A | ||
protected function f | ||
output Real x = 1.0; | ||
end f; | ||
end A; | ||
|
||
model Visibility4 | ||
A a; | ||
Real x = a.f(); | ||
end Visibility4; | ||
|
||
// Result: | ||
// Error processing file: Visibility4.mo | ||
// [flattening/modelica/scodeinst/Visibility4.mo:8:13-10:8:writable] Error: Illegal access of protected element f. | ||
// [flattening/modelica/scodeinst/Visibility4.mo:15:3-15:17:writable] Error: Variable a.f not found in scope Visibility4. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// endResult |