ballerina-lang
ballerina-lang copied to clipboard
Compiler gives incorrect error for variable usage in xml interpolated expressions
Consider the following code
import ballerina/io;
public function main() {
int|decimal|float|string|boolean firstExpr = 34;
xml<xml:Element> secondExpr = xml `<Book>"${firstExpr}"</Book>`;
}
This gives the following error
incompatible types: expected '(int|float|decimal|string|boolean|xml)', found '(int|decimal|float|string|boolean)'
Infact, the firstExpr
is allowed in xml as it is simpleType