ballerina-platform / ballerina-library

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

Can't use a map type as the expected type with `xmldata:parseAsType` #7333

Open MaryamZi opened 2 weeks ago

MaryamZi commented 2 weeks ago

Description

$title.

Steps to Reproduce

import ballerina/data.xmldata;

public function main() returns error? {
    xml x = xml `<employee><name>Joy</name></employee>`;
    // Allowed.
    record {| json...; |} _ = check xmldata:parseAsType(x);

    // invalid type: expected a record type
    map<json> _ = check xmldata:parseAsType(x);
}
$ bal run temp.bal 
Compiling source
        temp.bal
ERROR [temp.bal:(9:5,9:48)] invalid type: expected a record type

Version

v1.0.0

Environment Details (with versions)

No response