ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 58 forks source link

Incorrect error message for records with array fields in `data.xmldata` #6924

Open SasinduDilshara opened 1 month ago

SasinduDilshara commented 1 month ago

Code

import ballerina/data.xmldata;
import ballerina/test;

xml x1 = xml `<A>42</A>`;

type A11 record {
    int[] \#content;
};

type A12 record {int[] \#content;};

type A13 record {|
    int[]|string...;
|};

public function main() {
    A11|error a11 = xmldata:parseAsType(x1);
    test:assertEquals(a11, {});
}

Output

error Error ("class java.lang.Long cannot be cast to class io.ballerina.runtime.
internal.values.ArrayValue (java.lang.Long is in module java.base of loader 'boo
tstrap'; io.ballerina.runtime.internal.values.ArrayValue is in unnamed module of
 loader 'app')")

This should be an error message that didn't reflect the internal details.