From ee384315723ba16933491e010a95f22cb4b84635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=96stlund?= Date: Sun, 4 Dec 2016 13:32:10 +0100 Subject: [PATCH] Updated nfinst test cases. --- .../scodeinst/ComponentAsTypeError.mo | 2 +- flattening/modelica/scodeinst/Makefile | 14 ++++---- flattening/modelica/scodeinst/const13.mo | 2 +- flattening/modelica/scodeinst/inst4.mo | 26 +++----------- flattening/modelica/scodeinst/inst5.mo | 26 ++++++++++++++ flattening/modelica/scodeinst/lookup1.mo | 30 ++++++++++++++++ flattening/modelica/scodeinst/lookup2.mo | 30 ++++++++++++++++ flattening/modelica/scodeinst/lookup3.mo | 34 +++++++++++++++++++ flattening/modelica/scodeinst/lookup4.mo | 34 +++++++++++++++++++ 9 files changed, 169 insertions(+), 29 deletions(-) create mode 100644 flattening/modelica/scodeinst/inst5.mo create mode 100644 flattening/modelica/scodeinst/lookup1.mo create mode 100644 flattening/modelica/scodeinst/lookup2.mo create mode 100644 flattening/modelica/scodeinst/lookup3.mo create mode 100644 flattening/modelica/scodeinst/lookup4.mo diff --git a/flattening/modelica/scodeinst/ComponentAsTypeError.mo b/flattening/modelica/scodeinst/ComponentAsTypeError.mo index 07c9ea8b312..e5e14a6ee08 100644 --- a/flattening/modelica/scodeinst/ComponentAsTypeError.mo +++ b/flattening/modelica/scodeinst/ComponentAsTypeError.mo @@ -13,7 +13,7 @@ end ComponentAsTypeError; // Result: // Error processing file: ComponentAsTypeError.mo -// [flattening/modelica/scodeinst/ComponentAsTypeError.mo:11:3-11:6:writable] Error: Class x not found in scope . +// [flattening/modelica/scodeinst/ComponentAsTypeError.mo:11:3-11:6:writable] Error: Expected x to be a class, but found component instead. // // # Error encountered! Exiting... // # Please check the error message and the flags. diff --git a/flattening/modelica/scodeinst/Makefile b/flattening/modelica/scodeinst/Makefile index deb8ac83ac0..b08116bddf3 100644 --- a/flattening/modelica/scodeinst/Makefile +++ b/flattening/modelica/scodeinst/Makefile @@ -9,11 +9,13 @@ bindings5.mo \ bindings7.mo \ builtinmod2.mo \ BuiltinTime.mo \ +ClassAsComponentError.mo \ ComponentAsTypeError.mo \ cond4.mo \ conn1.mo \ conn2.mo \ const3.mo \ +const13.mo \ DuplicateMod1.mo \ DuplicateMod2.mo \ DuplicateMod3.mo \ @@ -26,6 +28,12 @@ ImportNamed1.mo \ ImportNamed2.mo \ ImportNested1.mo \ ImportQualified1.mo \ +inst4.mo \ +inst5.mo \ +lookup1.mo \ +lookup2.mo \ +lookup3.mo \ +lookup4.mo \ loop2.mo \ mod10.mo \ mod11.mo \ @@ -54,7 +62,6 @@ usertype6.mo \ FAILINGTESTFILES=\ bindings4.mo \ builtinmod.mo \ -ClassAsComponentError.mo \ compfunc.mo \ conn3.mo \ conn4.mo \ @@ -66,9 +73,7 @@ const4.mo \ const5.mo \ const7.mo \ const8.mo \ -const9.mo \ const10.mo \ -const13.mo \ const14.mo \ const15.mo \ const16.mo \ @@ -97,7 +102,6 @@ eq6.mo \ eq7.mo \ eq8.mo \ eq9.mo \ -eq10.mo \ expconn4.mo \ expconn7.mo \ ExtendSections.mo \ @@ -119,7 +123,6 @@ ImportQualifiedInvalid2.mo \ ImportShadowing1.mo \ ImportUnqualified1.mo \ inst3.mo \ -inst5.mo \ inst6.mo \ inst8.mo \ InvalidComplexConnectorType1.mo \ @@ -205,7 +208,6 @@ function1.mo \ FunctionRecordArg1.mo \ ImportUnqualified2.mo \ inst7.mo \ -inst4.mo \ loop1.mo \ MultiInheritanceRedeclare1.mo \ noretcall1.mo \ diff --git a/flattening/modelica/scodeinst/const13.mo b/flattening/modelica/scodeinst/const13.mo index b01b4253a57..11bc99faf6f 100644 --- a/flattening/modelica/scodeinst/const13.mo +++ b/flattening/modelica/scodeinst/const13.mo @@ -22,7 +22,7 @@ end C; // Result: // Error processing file: const13.mo -// [flattening/modelica/scodeinst/const13.mo:20:3-20:17:writable] Error: Lookup of element B is not allowed via component a when looking for a.B.y (only function calls may be looked up via a component). +// [flattening/modelica/scodeinst/const13.mo:20:3-20:17:writable] Error: Found class y during lookup of composite component name 'a.B.y', expected component. // // # Error encountered! Exiting... // # Please check the error message and the flags. diff --git a/flattening/modelica/scodeinst/inst4.mo b/flattening/modelica/scodeinst/inst4.mo index 451174a697f..1a20b17c3c8 100644 --- a/flattening/modelica/scodeinst/inst4.mo +++ b/flattening/modelica/scodeinst/inst4.mo @@ -3,7 +3,6 @@ // status: incorrect // cflags: -d=newInst // -// FAILREASON: Invalid mix of extensions not checked. // @@ -21,26 +20,11 @@ model A end A; // Result: +// Error processing file: inst4.mo +// [flattening/modelica/scodeinst/inst4.mo:14:3-14:15:writable] Error: A class extending from builtin type Real may not have other elements. // -// EXPANDED FORM: +// # Error encountered! Exiting... +// # Please check the error message and the flags. // -// class A -// Real r; -// end A; -// -// -// Found 1 components and 0 parameters. -// class A -// final parameter String r.unit = ""; -// final parameter String r.quantity = ""; -// final parameter String r.displayUnit = ""; -// final parameter Real r.min = 0.0; -// final parameter Real r.max = 0.0; -// final parameter Real r.start = 0.0; -// final parameter Boolean r.fixed = false; -// final parameter Real r.nominal; -// final parameter enumeration(never, avoid, default, prefer, always) r.stateSelect = StateSelect.default; -// final parameter enumeration(given, sought, refine) r.uncertain = Uncertainty.given; -// Real r.x; -// end A; +// Execution failed! // endResult diff --git a/flattening/modelica/scodeinst/inst5.mo b/flattening/modelica/scodeinst/inst5.mo new file mode 100644 index 00000000000..8f17e1dc2bc --- /dev/null +++ b/flattening/modelica/scodeinst/inst5.mo @@ -0,0 +1,26 @@ +// name: inst5.mo +// keywords: +// status: correct +// cflags: -d=newInst +// +// Check that instances are cloned properly, so that modifiers don't "stick" to +// a class. +// + +model A + Real x; +end A; + +model B + A a1(x = 3); + A a2; + A a3(x = 5); +end B; + +// Result: +// class B +// Real a1.x = 3; +// Real a2.x; +// Real a3.x = 5; +// end B; +// endResult diff --git a/flattening/modelica/scodeinst/lookup1.mo b/flattening/modelica/scodeinst/lookup1.mo new file mode 100644 index 00000000000..d49762b0938 --- /dev/null +++ b/flattening/modelica/scodeinst/lookup1.mo @@ -0,0 +1,30 @@ +// name: lookup1.mo +// keywords: +// status: incorrect +// cflags: -d=newInst +// + +model A + model B + model C + Real x; + end C; + end B; + + B b; +end A; + +model M + A a; + a.B b; +end M; + +// Result: +// Error processing file: lookup1.mo +// [flattening/modelica/scodeinst/lookup1.mo:19:3-19:8:writable] Error: Class name 'a.B' was found via a component (only component and function call names may be accessed in this way). +// +// # Error encountered! Exiting... +// # Please check the error message and the flags. +// +// Execution failed! +// endResult diff --git a/flattening/modelica/scodeinst/lookup2.mo b/flattening/modelica/scodeinst/lookup2.mo new file mode 100644 index 00000000000..2fafebbdb26 --- /dev/null +++ b/flattening/modelica/scodeinst/lookup2.mo @@ -0,0 +1,30 @@ +// name: lookup2.mo +// keywords: +// status: incorrect +// cflags: -d=newInst +// + +model A + model B + model C + Real x; + end C; + end B; + + B b; +end A; + +model M + A a; + A.b.C c; +end M; + +// Result: +// Error processing file: lookup2.mo +// [flattening/modelica/scodeinst/lookup2.mo:19:3-19:10:writable] Error: Class name 'A.b.C' was found via a component (only component and function call names may be accessed in this way). +// +// # Error encountered! Exiting... +// # Please check the error message and the flags. +// +// Execution failed! +// endResult diff --git a/flattening/modelica/scodeinst/lookup3.mo b/flattening/modelica/scodeinst/lookup3.mo new file mode 100644 index 00000000000..716802b67d0 --- /dev/null +++ b/flattening/modelica/scodeinst/lookup3.mo @@ -0,0 +1,34 @@ +// name: lookup3.mo +// keywords: +// status: incorrect +// cflags: -d=newInst +// + +model A + model B + model C + model D + Real x; + end D; + + D d; + end C; + end B; + + B b; +end A; + +model M + A a; + Real x = a.B.C; +end M; + +// Result: +// Error processing file: lookup3.mo +// [flattening/modelica/scodeinst/lookup3.mo:23:3-23:17:writable] Error: Class name 'a.B.C' was found via a component (only component and function call names may be accessed in this way). +// +// # Error encountered! Exiting... +// # Please check the error message and the flags. +// +// Execution failed! +// endResult diff --git a/flattening/modelica/scodeinst/lookup4.mo b/flattening/modelica/scodeinst/lookup4.mo new file mode 100644 index 00000000000..6e85a4faa6c --- /dev/null +++ b/flattening/modelica/scodeinst/lookup4.mo @@ -0,0 +1,34 @@ +// name: lookup4.mo +// keywords: +// status: incorrect +// cflags: -d=newInst +// + +model A + model B + model C + model D + Real x; + end D; + + D d; + end C; + end B; + + B b; +end A; + +model M + A a; + Real x = a.b.C.d.x; +end M; + +// Result: +// Error processing file: lookup4.mo +// [flattening/modelica/scodeinst/lookup4.mo:23:3-23:21:writable] Error: Found class C during lookup of composite component name 'a.b.C.d.x', expected component. +// +// # Error encountered! Exiting... +// # Please check the error message and the flags. +// +// Execution failed! +// endResult