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]: Client declarations with @display annotation will miss the CLIENT qualifier in the SemanticAPI #39812

Closed
kanushka opened this issue Mar 7, 2023 · 0 comments
Labels
Priority/High Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation

Comments

@kanushka
Copy link
Contributor

kanushka commented Mar 7, 2023

Description

Client/Endpoint declarations with @display annotation will miss the CLIENT qualifier in the SemanticAPI types

Steps to Reproduce

Ballerina source

import ballerina/http;

service /abc on new http:Listener(9090) {

    http:Client nrmlEp; // Client without display annotation

    @display {
        label: "HTTP client",
        id: "InternalClient-b704fd5e-06b8-47df-89fe-6c462b5cdf4e"
    }
    http:Client annoEp; // Client with display annotation    

    function init() returns error? {
        self.annoEp = check new annoEp("http://example.com/");
        self.nrmlEp = check new nrmlEp("http://example.com/");
    }

    resource function get repos(string orgName, int max = 5) returns string|error? {

    }

}

In the above example, sematicAPI will give the CLIENT qualifier for the nrmlEp client node. But for the annoEp client node will not get the CLIENT qualifier. instead of it will get PUBLIC and SERVICE qualifiers. It seems the node with @display annotation will miss the CLIENT qualifier.

Optional<TypeSymbol> typeSymbol = this.semanticModel.type(node.lineRange());
TypeSymbol typeDescriptor = typeSymbol.get();

TypeSymbol rawType = typeDescriptor.typeKind() == TypeDescKind.TYPE_REFERENCE
        ? ((TypeReferenceTypeSymbol) typeDescriptor).typeDescriptor() : typeDescriptor;

ObjectTypeSymbol objectTypeSymbol = (ObjectTypeSymbol) rawType;

objectTypeSymbol.qualifiers()

// nrmlEp -> PUBLIC, CLIENT
// annoEp -> PUBLIC, SERVICE

Affected Version(s)

2201.3.2, 2201.4.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

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Mar 7, 2023
@anupama-pathirage anupama-pathirage 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 17, 2023
@kanushka kanushka added the Reason/Invalid Issue is invalid. label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/High Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

3 participants