Skip to content

[Bug]: Getting unexpected type error for configurable defined as nilable and has decimal fields #44376

@TharmiganK

Description

@TharmiganK

Description

$Subject

Steps to Reproduce

Run the below code with the Config.toml:

import ballerina/io;

public type Foo record {|
    int i = 10;
    decimal d = 4.5;
|};

public type Bar record {|
    Foo foo;
|};

public type Baz Bar;

configurable Baz? baz = ();

public function main() returns error? {
    io:println("Hello, World!");
}
[baz.foo]
i = 9
d = 9.76
error: [Config.toml:(1:1,3:9)] configurable variable 'baz' is expected to be of type '(scan:Baz & readonly)?', but found 'record'

Please note that the one of the below changes resolves the issue:

  • Change the decimal type to float
  • Change the configurable definition as below:
    configurable Baz baz = ?; // required
    Or
    configurable Baz baz = {foo: {}}; // optional with default

Affected Version(s)

Ballerina SwanLake Update 12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team/jBallerinaAll the issues related to BIR, JVM backend code generation and runtimeType/Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions