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]: typeOf() API returns incorrect result for simple name ref in xml attribute access expr #39015

Closed
IMS94 opened this issue Dec 12, 2022 · 3 comments
Assignees
Labels
Area/Compiler Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@IMS94
Copy link
Contributor

IMS94 commented Dec 12, 2022

Description

Consider the following code:

    xml x5 = xml `<para id="greeting">Hello</para>`;
    string|error id = x5.io:;

Here, when we perform semanticModel.typeOf() on x5 in x5.io: expression, the result is string|error, not xml.

When investigated seems like the relevant BLangNode's derivedType is also set to string|error in this case.

Steps to Reproduce

No response

Affected Version(s)

2201.3.0

OS, DB, other environment details and versions

No response

Related area

-> Editor

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@IMS94 IMS94 added Type/Bug Team/CompilerFETools Semantic API, Formatter, Shell Area/SemanticAPI Semantic API Related Issues #Compiler labels Dec 12, 2022
@IMS94
Copy link
Contributor Author

IMS94 commented Dec 12, 2022

In #38958, xml attribute access related test cases were disabled due to this

@dulajdilshan dulajdilshan added Area/Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. and removed Team/CompilerFETools Semantic API, Formatter, Shell Area/SemanticAPI Semantic API Related Issues #Compiler labels Dec 14, 2022
@dulajdilshan dulajdilshan moved this to Planned for Sprint in Ballerina Team Main Board Jan 18, 2024
@dulajdilshan dulajdilshan self-assigned this Jan 18, 2024
@dulajdilshan dulajdilshan moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Jan 31, 2024
@dulajdilshan
Copy link
Contributor

Checked this in 2201.3.1,

We get XMLTypeSymbol in typeOf for x5
image

And,
in later versions it gives null for null which is correct since x5 in x5.io: is not a complete expression (x5 here is a var-ref).

The original issue LS had was solved with expectedType API in Semantic Model.

Closing this as invalid

@github-project-automation github-project-automation bot moved this from In Progress to Done in Ballerina Team Main Board Feb 14, 2024
@dulajdilshan dulajdilshan added the Reason/Invalid Issue is invalid. label Feb 14, 2024
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
Archived in project
Development

No branches or pull requests

2 participants