Skip to content

[Bug]: Configurable Variables with Union Type Recognized as a Mutable Storage #44284

@ThisaruGuruge

Description

@ThisaruGuruge

Description

When a configurable variable is defined with the following type, it is identified as a mutable storage, and the compiler complains when we try to assign it to a record field default value.

Steps to Reproduce

Check the below code:

configurable string|string[]? fooConfig = ();

type Foo record {|
    string|string[]? foo = fooConfig;
|};

The error can be avoided when defined as a readonly varoable:

configurable readonly & (string|string[]?) fooConfig = ();

type Foo record {|
    string|string[]? foo = fooConfig;
|};

Affected Version(s)

2201.12.9

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

#43072

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions