ballerina-lang
ballerina-lang copied to clipboard
[Bug]: Compound Assignment operator `+=` allows adding xml values to variables of xml built-in subtypes
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