Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incorrect handling of reserved keyword in Ballerina data mapping generation. #43620

Closed
VellummyilumVinoth opened this issue Nov 20, 2024 · 4 comments
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Team/CompilerFETools Semantic API, Formatter, Shell Type/Bug userCategory/Compilation

Comments

@VellummyilumVinoth
Copy link

VellummyilumVinoth commented Nov 20, 2024

Description

When generating data mappings in Ballerina, the version field is incorrectly treated as a reserved keyword. Instead of generating the mapping as version: patient.version, the system produces an incorrect mapping like 'version: patient.'version, which is syntactically invalid. This causes the code to fail during execution or compilation.

Steps to Reproduce

1. Define Ballerina code

public function mapPatientToUsCore(Patient patient) returns Patient => {
   
};

public type Patient record {
    string patientType;
    string patientId;
    string version;
};

2. Generate data mappings using the defined structure.

3. Observe that the generated mapping incorrectly escapes the version field as 'version: patient.'version instead of the correct format version: patient.version.

public function mapPatientToUsCore(Patient patient) returns Patient => {
    patientType: patient.patientType,
    patientId: patient.patientId,
    'version: patient.'version
};

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Nov 20, 2024
@MaryamZi MaryamZi added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Team/CompilerFETools Semantic API, Formatter, Shell and removed needTriage The issue has to be inspected and labeled manually labels Nov 26, 2024
@MaryamZi
Copy link
Member

version used to be a keyword, adding the quote may be related to that.

But, it shouldn't fail and doesn't seem to fail for me either. Where/how does it fail?

@VellummyilumVinoth
Copy link
Author

VellummyilumVinoth commented Dec 6, 2024

Thanks Ack. This issue is not related with CompilerFE.

This is AI data mapper bug. We will fix it.

Copy link

github-actions bot commented Dec 6, 2024

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@VellummyilumVinoth
Copy link
Author

Reason/Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Team/CompilerFETools Semantic API, Formatter, Shell Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

3 participants