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]: The typeOf API returns a TypeDescriptorTypeSymbol instead of an IntersectionTypeSymbol for a narrowed variable #42690

Open
nipunayf opened this issue May 3, 2024 · 0 comments
Labels
Area/SemanticAPI Semantic API Related Issues #Compiler Team/CompilerFETools Semantic API, Formatter, Shell Type/Bug

Comments

@nipunayf
Copy link
Contributor

nipunayf commented May 3, 2024

Description

With the change made by #39585, the type of a narrowed symbol should be an intersection type rather than its effective type.

Steps to Reproduce

Use the typeOf API on the node covered by the following cursor positions.

function test() {
    readonly & Person|int person = {name: "A", age: 0};
    if person is int {
        return;
    }
    _ = <START>person<END>.entries();
}

Affected Version(s)

Ballerina 2201.9.0 (Swan Lake Update 9)

OS, DB, other environment details and versions

OS: macOS 14.4.1 23E224
JDK: openjdk 20.0.2 2023-07-18

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/CompilerFETools Semantic API, Formatter, Shell Area/SemanticAPI Semantic API Related Issues #Compiler labels May 3, 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/CompilerFETools Semantic API, Formatter, Shell Type/Bug
Projects
None yet
Development

No branches or pull requests

1 participant