Hi,

I updated my RDi to 9.6.0.6 and tried the new "Extract constant" feature.

"Extract constant" produces invalid source code, when the name of the
constant matches an existing field name.

For example:

Before:

//----------------------------------------------------------------------
// GLOBAL VARIABLES
//----------------------------------------------------------------------

// Number of assertions called.
D assertCalled s 10i 0

// Latest assertion failure event information. Can be blank if no
// assertion failure event since last assertion.
D assertFailEvt ds likeds(AssertFailEvtLong_t)

//----------------------------------------------------------------------
// Assert equality between two alphanumeric variables.
//----------------------------------------------------------------------
P aEqual...
P b export
D pi
D expected 32565a const
D actual 32565a const
D fieldName 64a const varying options(*nopass: *omit)

D msg s like(msgText_t) inz

/free

if (%parms() >= 3 and %addr(fieldName) <> *NULL);
msg = %trim(fieldName) + ': ';
endif;

msg = msg
+ 'Expected ' + QUOTE + %trimr(expected) + QUOTE + ','
+ ' but was ' + QUOTE + %trimr(actual ) + QUOTE + '.';
doAssert(expected = actual: msg: ONE_CALL_STK_LVL_ABOVE: 'aEqual');

/end-free
P e

After extracting 'Expected ' to EXPECTED:

//----------------------------------------------------------------------
// GLOBAL VARIABLES
//----------------------------------------------------------------------

// Number of assertions called.
D EXPECTED C 'Expected ' // <=== Inserted line
D assertCalled s 10i 0

// Latest assertion failure event information. Can be blank if no
// assertion failure event since last assertion.
D assertFailEvt ds likeds(AssertFailEvtLong_t)

//----------------------------------------------------------------------
// Assert equality between two alphanumeric variables.
//----------------------------------------------------------------------
P aEqual...
P b export
D pi
D expected 32565a const
D actual 32565a const
D fieldName 64a const varying options(*nopass: *omit)

D msg s like(msgText_t) inz

/free

if (%parms() >= 3 and %addr(fieldName) <> *NULL);
msg = %trim(fieldName) + ': ';
endif;

msg = msg
+ EXPECTED + QUOTE + %trimr(expected) + QUOTE + ','
+ ' but was ' + QUOTE + %trimr(actual ) + QUOTE + '.';
doAssert(expected = actual: msg: ONE_CALL_STK_LVL_ABOVE: 'aEqual');

/end-free
P e

The compiler error message is "RNF7421 Operands are not compatible with
the type of operator." in procedure, which is stored in the same module:

//----------------------------------------------------------------------
// Assert equality between two integers.
//----------------------------------------------------------------------
P iEqual...
P b export
D pi
D expected 31s 0 const
D actual 31s 0 const
D fieldName 64a const varying options(*nopass: *omit)

D msg s like(msgText_t) inz

/free

if (%parms() >= 3 and %addr(fieldName) <> *NULL);
msg = %trim(fieldName) + ': ';
endif;

msg = msg
+ EXPECTED + %char(expected) + ','
+ ' but was ' + %char(actual ) + '.';
doAssert(expected = actual: msg: ONE_CALL_STK_LVL_ABOVE: 'iEqual');

/end-free
P e

Can somebody confirm the problem?

Regards,

Thomas.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.