CS143-Lab/assignments/PA4/bad_inherit.cl
2023-03-24 11:56:17 +00:00

45 lines
956 B
Common Lisp

(* The inheritance analysis has 2 stages, graph construction & cyclic checking.
it will abort if duplicate or undefined class definitions are found before do cyclic checking *)
-- uncomment the lines below to get convinced that 1st stage works
(*
class DupDef {};
class DupDef {};
class DupDef1 {};
class DupDef1 {};
class A inherits SCHEISSE{};
*)
(*
class D inherits D {};
class Cycle1 inherits Cycle2 {};
class Cycle2 inherits Cycle3 {};
class Cycle3 inherits Cycle1 {};
class Cycle4 inherits Cycle3 {};
*)
class Ok1{};
class Ok2_1 inherits Ok1 {};
class Ok2_2 inherits Ok1 {};
class Ok3 inherits Ok2_1 {};
class Ok4 inherits Ok2_2 {};
(* Cool has restrictions on inheriting from basic classes *)
class Err1 inherits Int {};
class Err3 inherits String {};
class Err3 inherits Bool {};
class Err4 inherits Err3 {};
class Err4 inherits NOEXIST {};
class Main inherits IO {
main(): Object {
{
a();
}
};
};