classage X { mixer J { import void t0(Sub1 x) import Sub2 t3() export void t5() { /***************************************************************** Followed is typechecking of passive invocation expression inside a mixer. None of the expressions, unless noted otherwise, typecheck ******************************************************************/ // t1 does not exist t1(); // type mismatch on the contravariants t0(); t0(3); // however the following works t0(create Sub1()); // type mismatch on assignment, a test on the covariant int x = t3(); Sub1 y = t3(); // however the following works Sub2 z = t3(); } } mixer U { import void t0(Sub1 x) export void t0(Sub2 x) {} import Sub2 t3() } Sub1 tlocal(Sub2 x) { return create Sub1(); } int fieldx = 0; void t() { /***************************************************************** Followed is the simple local declaration check ******************************************************************/ // P does not exist as a type // P x; /***************************************************************** Followed is typechecking of the X::m() expression used for mixer invocation None of the expressions, unless noted otherwise, typecheck ******************************************************************/ // M does not exist // M::t0(create Sub2()); // type mismatch on the contravariants U::t0(); U::t0(3); // for the following the test is to make the signature being used // is the import, to ensure soundness. // were it to use the export signature, the following would // typecheck, and the disaster would be when U is satisfied // externally with some export with the import signature, // runtime error would ensue. U::t0(create Sub2()); // however the following works U::t0(create Sub1()); // type mismatch on assignment, a test on the covariant int x = U::t3(); Sub1 y = U::t3(); // however the following works Sub2 z = U::t3(); /***************************************************************** Followed is typechecking of the ::m() expression used for local method invocation None of the expressions, unless noted otherwise, typecheck ******************************************************************/ // tx does not exist ::tx(create Sub2()); // type mismatch on the contravariants ::tlocal(); ::tlocal(3); // however the following works ::tlocal(create Sub2()); ::tlocal(create Sub1()); // type mismatch on assignment, a test on the covariant int xx = ::tlocal(create Sub2()); // however the following works Sub1 yy = ::tlocal(create Sub2()); Sub2 zz = ::tlocal(create Sub2()); /***************************************************************** Followed is typechecking of the local field access expression None of the expressions, unless noted otherwise, typecheck ******************************************************************/ // fieldc does not exist ::fieldc = true; Sub1 yyy = ::fieldc; // type mismatch ::fieldx = true; Sub1 yyyy = ::fieldx; return; } /***************************************************************** Followed is the simple formal parameter declaration check ******************************************************************/ // P does not exist as a type // void t10 (P x) { } } classage Sub1 { connector E { export void a() { return; } } } classage Sub2 { connector E { export void a() { return; } import void c() } }