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

Open
VellummyilumVinoth opened this issue Nov 20, 2024 · 1 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

Comments

@VellummyilumVinoth
Copy link

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?

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