Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incorrect compiler incompatible types error when a type is of the expected type #42439

Open
chamajay opened this issue Mar 30, 2024 · 0 comments · May be fixed by #42582
Open

[Bug]: Incorrect compiler incompatible types error when a type is of the expected type #42439

chamajay opened this issue Mar 30, 2024 · 0 comments · May be fixed by #42582
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation

Comments

@chamajay
Copy link

Description

The code snippet in the "Steps to Reproduce" section triggers an incompatible types error, even though the variable has the expected type. As temporary workarounds, a type cast or var can be used.

Steps to Reproduce

import ballerinax/health.fhir.r4;

r4:ResourceAPIConfig apiConfig = {
    resourceType: "",
    profiles: [],
    defaultProfile: (),
    searchParameters: [],
    operations: [],
    serverConfig: (),
    authzConfig: ()
};

public function main() {
    r4:OperationConfig[] & readonly operations = apiConfig.operations;
}

This triggers the compiler error: ERROR [main.bal:(14:50,14:70)] incompatible types: expected '(ballerinax/health.fhir.r4:4.3.3:OperationConfig[] & readonly)', found '(ballerinax/health.fhir.r4:4.3.3:OperationConfig[] & readonly)'

Affected Version(s)

Ballerina 2201.8.6 (Swan Lake Update 8)

OS, DB, other environment details and versions

OS: Windows 10
r4 package version: 4.3.3

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Mar 30, 2024
@MaryamZi MaryamZi added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. and removed needTriage The issue has to be inspected and labeled manually labels Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation
Projects
None yet
3 participants