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]: Compound Assignment operator += allows adding xml values to variables of xml built-in subtypes #42350

Open
poorna2152 opened this issue Mar 20, 2024 · 0 comments
Assignees
Labels
Lang/XML XML related issues Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@poorna2152
Copy link
Contributor

Description

Consider the following scenarios,

public function main() {
    xml:Element x1 = xml `<foo/>`;
    x1 += xml `<bar/>`;

    xml:ProcessingInstruction x2 = xml `<?foo?>`;
    x2 += xml `<bar/>`;

    xml:Comment x3 = xml `<!--foo-->`;
    x3 += xml `<?bar?>`;
}

These should ideally return an error.
However the following code gives the expected error.

public function main() {
    xml:Element x1 = xml `<foo/>`;
    x1 = x1 + xml `<bar/>`;

    xml:ProcessingInstruction x2 = xml `<?foo?>`;
    x2 = x2 + xml `<bar/>`;

    xml:Comment x3 = xml `<!--foo-->`;
    x3 = x3 + xml `<?bar?>`;
}

Steps to Reproduce

No response

Affected Version(s)

2201.8.6

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

@poorna2152 poorna2152 added Type/Bug Lang/XML XML related issues Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Mar 20, 2024
@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Mar 20, 2024
@poorna2152 poorna2152 removed needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Mar 20, 2024
@poorna2152 poorna2152 self-assigned this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang/XML XML related issues Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
Status: No status
Development

No branches or pull requests

2 participants