ballerina-platform / ballerina-lang

The Ballerina Programming Language

Home Page:https://ballerina.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Referred type is wrong for regxp:RegExp

prakanth97 opened this issue · comments

Description

Here

record {|
  int:Unsigned8 x;
|} val = check xmldata:parseString(xmlStr);

If we check the expected type of field x in the runtime. The referred type is properly defined.

Screenshot 2024-05-21 at 10 55 07

But if we change the type to regexp:RegExp, the referred type is set as anydata and readonly
Screenshot 2024-05-21 at 10 56 31

This is wrong. Here we can not distinguish between anydata and regexp:RegExp

Steps to Reproduce

No response

Affected Version(s)

2201.9.0

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

In the RegExpValue we have set the type as readonly & anydata causing this issue.

private static final Type type = PredefinedTypes.TYPE_READONLY_ANYDATA;

In the runtime we don't have BType representation for RegExp type. Because of that we cannot predefine it and assign to the value. @pcnfernando Was there any reason not to have a runtime BType representation?