Version: trunk [r13344] (Linux x86_64); also [r13317], [r13324] and [r13331]. Component: interpreter (RexxActivation).
In a method, the handler of a CALL ON gets Error 97.2 for self~privateMethod, while the same send works from the method's body and from an internal routine the method calls with CALL:
.t~new~go
::class t
::method go
expose n
n = 0
call sub
say "internal CALL: ok, n=" || n
call on error name h
address system "exit 3"
say "CALL ON ERROR handler: ok, n=" || n
return
sub: n = self~ok + 1; return
h: n = self~ok + 1; return
::method ok private
expose n
return n
Output:
internal CALL: ok, n=1
Error 97.2: Object "a T" cannot accept private message "OK" from this context.
The same for any condition (USER, NOTREADY, ANY...). A CALL ON handler is an internal routine of the method, so the send should be allowed.
Cause: RexxActivation::internalCallTrap() runs the handler's activation with run(OREF_NULL, ...), while internalCall() passes the method's receiver. RexxObject::checkPrivate() takes the sender from the top activation's getReceiver(); with no receiver it treats the handler as a routine and refuses the private method. (SELF itself works in the handler: it is inherited with the variables.)
Fix (1 line): pass receiver in internalCallTrap(), as internalCall() does.
Tests: two in ooRexx/base/keyword/CALL.testGroup: test_on_handler_private_message (CALL ON NOTREADY in the test method, with CHARIN of "/"; the same label also called with CALL) and test_on_any_handler_private_message (CALL ON ANY in an internal routine of the method).
Results on [r13344], Linux, Release: CALL.testGroup 27/27 with the fix (without it, the 2 new tests fail with 97.2); full test suite (24,343 tests) with no differences except the 2 new tests. Patches attached (main, test), against [r13344].
Commit: [r13317]
Commit: [r13324]
Commit: [r13331]
Commit: [r13344]
Anonymous