Index: generic/nsf.c =================================================================== diff -u -rd1d314bac8a9baa0268fc673623432290adb08b7 -rb4266efa283e86989f6f09f3938f41f173580400 --- generic/nsf.c (.../nsf.c) (revision d1d314bac8a9baa0268fc673623432290adb08b7) +++ generic/nsf.c (.../nsf.c) (revision b4266efa283e86989f6f09f3938f41f173580400) @@ -7760,7 +7760,6 @@ NsfClasses *filterCheck, *osl = NULL; NsfObjectSystem *osPtr; NsfClass **scl; - int reversed = 0; int i, j; filterCheck = ComputeOrder(cl, SUPER_CLASSES); @@ -7778,8 +7777,10 @@ FilterRemoveDependentFilterCmds(cl, filterCheck->cl); } - /* invalidate all interceptors orders of instances of this - and of all depended classes */ + /* + * Invalidate all interceptors orders of instances of this and of all + * depended classes. + */ MixinInvalidateObjOrders(interp, cl); FilterInvalidateObjOrders(interp, cl); @@ -7792,23 +7793,19 @@ } /* - * check that superclasses don't precede their classes + * Check that superclasses don't precede their classes. */ - for (i = 0; i < oc; i++) { - if (reversed) break; for (j = i+1; j < oc; j++) { NsfClasses *dl = ComputeOrder(scl[j], SUPER_CLASSES); - if (reversed) break; dl = NsfClassListFind(dl, scl[i]); - if (dl) reversed = 1; + if (dl) { + FREE(NsfClass**, scl); + return NsfObjErrType(interp, "superclass", arg, "classes in dependence order", NULL); + } } } - if (reversed) { - return NsfObjErrType(interp, "superclass", arg, "classes in dependence order", NULL); - } - /* * Ensure that the current class and new superclasses are from the * same object system. @@ -7817,7 +7814,7 @@ for (i = 0; i < oc; i++) { if (osPtr != GetObjectSystem(&scl[i]->object)) { FREE(NsfClass**, scl); - return NsfPrintError(interp, "class \"%s\" has different object system as class \"%s\"", + return NsfPrintError(interp, "class \"%s\" has a different object system as class \"%s\"", ClassName(cl), ClassName(scl[i])); } } Index: tests/contains.test =================================================================== diff -u -ra24e1f836c3126d0a0e9467bde3a9fa8da901711 -rb4266efa283e86989f6f09f3938f41f173580400 --- tests/contains.test (.../contains.test) (revision a24e1f836c3126d0a0e9467bde3a9fa8da901711) +++ tests/contains.test (.../contains.test) (revision b4266efa283e86989f6f09f3938f41f173580400) @@ -3,7 +3,7 @@ # # Intentionally, we do not want to make a "namespace import" in this -# test file. +# test file. Run this file via a pure tclsh! # namespace path nx @@ -105,19 +105,20 @@ package require XOTcl ######################################################################## +# trigger the call of "cleanup" to work via method dispatch +::xotcl::Object create o1 +o1 proc cleanup {} {return} + +######################################################################## # # Test that we do not allow to mix object systems within the intrinsic # classes of an object. Otherwise we would have problems with the # recreate "C0 create c0". On a recreate of c0 the object system for # C0 is ::xotcl, therefore we try to call recreate. In the C0 class # hierarchy is from nx and contains no "recreate" method. -# trigger the call of "cleanup" to work via method dispatch -::xotcl::Object create o1 -o1 proc cleanup {} {return} - ? {catch {::xotcl::Class create C0 -superclass ::nx::Object} errorMsg} 1 -? {set ::errorMsg} {class "::C0" has different object system as class "::nx::Object"} +? {set ::errorMsg} {class "::C0" has a different object system as class "::nx::Object"} ::nx::Class create C1 -superclass ::nx::Object #C0 create c0