While looking at the FORWARD keyword statement and using "validateScopeOverride(superClass)" among
mixin classes, where the receiver is a class object, errors get raised.
Turning back to the Message.testgroup and adding tests sending class messages causes the first test
to fail already.
Here the test code and the class definitions that got class methods added to
them:
... cut ... (works)
::method test_override_among_mixinclasses
o=.mixin2~new
self~assertEquals("mixin2" , o~info)
self~assertEquals("mixin2" , o~info:.mixin2)
self~assertEquals("base" , o~info:.base)
self~assertEquals("mixin1a", o~info:.mixin1a)
self~assertEquals("mixin1b", o~info:.mixin1b)
self~expectSyntax(93.957) -- "Target object "a MIXIN2" is not a subclass of
the message override scope (The NIXINOXI class)."
o~info:.nixinoxi
... cut ... (causes an error)
-- SEND at class level in mixins
::method test_send_override_among_mixinclasses_class
o=.mixin2 -- use the class object
m=.message~new(o,"clzInfo")
self~assertEquals("mixin2_class" , m~send)
m=.message~new(o,("clzInfo",.mixin2))
*self~assertEquals("mixin2_class" , m~send)*
m=.message~new(o,("clzInfo",.base))
self~assertEquals("base_class" , m~send)
m=.message~new(o,("clzInfo",.mixin1a))
self~assertEquals("mixin1a_class" , m~send)
m=.message~new(o,("clzInfo",.mixin1b))
self~assertEquals("mixin1b_class" , m~send)
self~expectSyntax(93.957) -- "Target object "a MIXIN2" is not a subclass of
the message override scope (The NIXINOXI class)."
m=.message~new(o, ("clzInfo",.nixinoxi))
m~send
... cut ...
::class nixinoxi -- has info method, but class is on its own
::method clzInfo class
return "nixinoxi_class"
::method info
return "nixinoxi"
::class base
::method clzInfo class
return "base_class"
::method info
return "base"
::class mixin1a mixinclass base
::method clzInfo class
return "mixin1a_class"
::method info
return "mixin1a"
::class mixin1b mixinclass base
::method clzInfo class
return "mxin1b_class"
::method info
return "mixin1b"
::class mixin2 mixinclass mixin1b inherit mixin1a
::method clzInfo class
return "mixin2_class"
::method info
return "mixin2"
Running the test group yields the following result with an error:
F:\work\svn\oorexx\test\trunk>rexx ooRexx/base/class/Message.testGroup
Interpreter: REXX-ooRexx_5.0.0(MT)_64-bit 6.05 17 May 2022
OS Name: WindowsNT
SysVersion: Windows 10.0.19043
Tests ran: 70
Assertions: 266
Failures: 0
Errors: 1
[error] 20220518 14:26:05.453000
Test: TEST_SEND_OVERRIDE_AMONG_MIXINCLASSES_CLASS
Class: Message.testGroup
File: ...\oorexx\test\trunk\ooRexx\base\class\Message.testGroup
Event: SYNTAX 93.957 raised unexpectedly.
*Target object "The MIXIN2 class" is not a subclass of the message
override scope (The MIXIN2
class).*
Line: 735
*-* Compiled method "SEND" with scope "Message".
735 *-* self~assertEquals("mixin2_class" , m~send)
*-* Compiled method "SEND" with scope "Message".
1615 *-* .message~new(self, methodName)~send
1578 *-* self~doTheTest(fName, aTestResult) -- carry out the testmethod
552 *-* test~execute(testResult, verbose)
552 *-* test~execute(testResult, verbose)
45 *-* testResult = group~suite~execute~~print
Test execution: 00:00:18.115000
ObjectClass.cpp defines validateScopeOverride() as:
/**
* Validate a scope override on a message send.
*
* @param scope The scope we're checking.
*/
void RexxObject::validateScopeOverride(RexxClass *scope)
{
if (scope != OREF_NULL)
{
if (!isInstanceOf(scope))
{
reportException(Error_Incorrect_method_array_noclass, this,
scope);
}
}
}
Should ObjectClass.validateScopeOverride() be changed to check in addition whether "this" is a class
object and if so, use maybe isSubClassOrEnhanced() instead of isInstanceOf()?
If so, what would be the best approach, the best code for this?
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel