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]: Module symbols are intermittently missing when retrieved through the semantic model #43695

Open
nipunayf opened this issue Dec 10, 2024 · 0 comments
Labels
Area/SemanticAPI Semantic API Related Issues #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@nipunayf
Copy link
Contributor

nipunayf commented Dec 10, 2024

Description

The module symbols are missing when obtained through the semantic model available in the module compilation by the project API.

image

Steps to Reproduce

Retrieve the module symbols through the process described above for the following source code.

import ballerina/http;
import ballerina/log;

configurable int servicePort = 8080;

// In-memory storage for rooms
map<Room> rooms = {
    "room1": {id: "room1", name: "Deluxe Room", available: true, price: 100.00},
    "room2": {id: "room2", name: "Suite", available: true, price: 150.00},
    "room3": {id: "room3", name: "Standard Room", available: true, price: 80.00}
};

service / on new http:Listener(servicePort) {
    resource function get rooms() returns Room[]|error|error {
        do {
            string var1 = "hello world";
            log:printInfo(var1);
            log:printInfo("Retrieving all rooms");
            return rooms.toArray();

        } on fail var e {
            return e;
        }
    }

    resource function post bookRoom(@http:Payload RoomBookingRequest bookingRequest) returns RoomBookingResponse|error|error {
        do {

            string roomId = bookingRequest.roomId;
            Room? room = rooms[roomId];

            if room is () {
                return {message: string `Room ${roomId} not found`, room: ()};
            }

            if !room.available {
                return {message: string `Room ${roomId} is not available`, room: ()};
            }

            room.available = false;
            rooms[roomId] = room;

            return {message: string `Room ${roomId} booked successfully for ${bookingRequest.guestName}`, room: room};

        } on fail var e {
            return e;
        }
    }
}

Affected Version(s)

2201.11.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

@nipunayf nipunayf added Type/Bug Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/SemanticAPI Semantic API Related Issues #Compiler labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/SemanticAPI Semantic API Related Issues #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
None yet
Development

No branches or pull requests

1 participant