Project

General

Profile

Bug #10973

REGRESSION: No string literal to LONGCHAR conversion for 4GL class method call parameters

Added by Vladimir Tsichevski 8 months ago. Updated 7 months ago.

Status:
Review
Priority:
Normal
Assignee:
Vladimir Tsichevski
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
16301
version_resolved:
production:
No
env_name:
topics:

Related issues

Copied from Base Language - Bug #7184: Incorrect conversion of concatenated string literals to a LONGCHAR Closed

History

#1 Updated by Vladimir Tsichevski 8 months ago

This issue affects the FWD conversion when passing a CHARACTER literal as an argument to a class method expecting a LONGCHAR parameter. The converter omits the required new longchar(...) wrapper, causing a type mismatch in the generated Java code.

Conversion Test Case

Convert the following 4GL class (e.g., unittests/TestCharacterLiteralConversion.cls):

CLASS unittests.TestCharacterLiteralConversion:

  METHOD PUBLIC VOID methodWithLongcharParameter(INPUT arg AS LONGCHAR):
      RETURN.
  END METHOD.

  METHOD PUBLIC VOID test():
     methodWithLongcharParameter('a').
   END METHOD.
END CLASS.

This defines a method accepting LONGCHAR and calls it with a literal ('a').

Expected Behavior (Correct Conversion)

The generated Java should promote the literal via explicit LONGCHAR construction:

methodWithLongcharParameter(new longchar("a"));

Actual Behavior (FWD Converter)

The literal is passed directly as a Java String literal:

methodWithLongcharParameter("a");

This causes a compilation error (type mismatch: String not assignable to longchar).

#2 Updated by Vladimir Tsichevski 8 months ago

  • Copied from Bug #7184: Incorrect conversion of concatenated string literals to a LONGCHAR added

#3 Updated by Vladimir Tsichevski 8 months ago

  • Subject changed from No string literal to LONGCHAR conversion for 4GL class method call parameters to REGRESSION: No string literal to LONGCHAR conversion for 4GL class method call parameters

This is a regression, this issue did not exist in trunk rev. 14527 when the task #7184 was worked on.

#4 Updated by Vladimir Tsichevski 7 months ago

Vladimir Tsichevski wrote:

This is a regression, this issue did not exist in trunk rev. 14527 when the task #7184 was worked on.

Seems this issue does not exist. Other issues mentioned in #7184 do exist still: the longchar constructor is applied two times to a string literal instead of one.

#5 Updated by Vladimir Tsichevski 7 months ago

  • Status changed from New to WIP
  • % Done changed from 0 to 100

Vladimir Tsichevski wrote:

...the longchar constructor is applied two times to a string literal instead of one.

This fixed in 10973a rev. 16305.

When promoting a string literal to longchar (or similar type conversions) via constructor wrapping, ensure the literal is not already wrapped in a matching constructor call.

#6 Updated by Vladimir Tsichevski 7 months ago

  • Status changed from WIP to Review

Also available in: Atom PDF