summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-08-17 15:23:49 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-08-17 15:23:49 (GMT)
commit1c058969f08127a16e91339f83fc824493ac28cb (patch)
tree2a6eb020aa974d90a04c4220556ea8c3959bb93c
parent538b31bdc34b5021d70dfbe2a2787a1293f225a8 (diff)
downloadtcl-1c058969f08127a16e91339f83fc824493ac28cb.zip
tcl-1c058969f08127a16e91339f83fc824493ac28cb.tar.gz
tcl-1c058969f08127a16e91339f83fc824493ac28cb.tar.bz2
[7d52e1101b] oo::object should know that oo::class is a subclass.
-rw-r--r--generic/tclOO.c1
-rw-r--r--tests/oo.test17
2 files changed, 18 insertions, 0 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 02e00c9..ace47fe 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -394,6 +394,7 @@ InitFoundation(
fPtr->classCls->flags |= ROOT_CLASS;
TclOOAddToInstances(fPtr->objectCls->thisPtr, fPtr->classCls);
TclOOAddToInstances(fPtr->classCls->thisPtr, fPtr->classCls);
+ TclOOAddToSubclasses(fPtr->classCls, fPtr->objectCls);
AddRef(fPtr->objectCls->thisPtr);
AddRef(fPtr->objectCls);
diff --git a/tests/oo.test b/tests/oo.test
index fcd9818..8c515da 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -283,6 +283,23 @@ test oo-1.20 {basic test of OO functionality: my teardown post rename} -body {
obj destroy
info commands ::AGlobalName
} -result {}
+test oo-1.21 {basic test of OO functionality: default relations} -setup {
+ set fresh [interp create]
+} -body {
+ lmap x [$fresh eval {
+ foreach cmd {instances subclasses mixins superclass} {
+ foreach initial {object class Slot} {
+ lappend x [info class $cmd ::oo::$initial]
+ }
+ }
+ foreach initial {object class Slot} {
+ lappend x [info object class ::oo::$initial]
+ }
+ return $x
+ }] {lsort $x}
+} -cleanup {
+ interp delete $fresh
+} -result {{} {::oo::Slot ::oo::class ::oo::object} {::oo::define::filter ::oo::define::mixin ::oo::define::superclass ::oo::define::variable ::oo::objdefine::filter ::oo::objdefine::mixin ::oo::objdefine::variable} {::oo::Slot ::oo::class} {} {} {} {} {} {} ::oo::object ::oo::object ::oo::class ::oo::class ::oo::class}
test oo-2.1 {basic test of OO functionality: constructor} -setup {
# This is a bit complex because it needs to run in a sub-interp as