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

Fix several CCE issues in query expressions that has string and xml types as the expected type. #40041

Merged

Conversation

SasinduDilshara
Copy link
Contributor

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues.

Fixes #39641
Fixes #40029
Fixes #40030
Fixes #40038

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@SasinduDilshara SasinduDilshara added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Mar 30, 2023
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (632810d) 76.45% compared to head (4bc3a90) 76.45%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #40041   +/-   ##
=========================================
  Coverage     76.45%   76.45%           
  Complexity    55324    55324           
=========================================
  Files          3388     3388           
  Lines        208408   208413    +5     
  Branches      26980    26981    +1     
=========================================
+ Hits         159333   159340    +7     
+ Misses        40302    40295    -7     
- Partials       8773     8778    +5     
Impacted Files Coverage Δ
...2/ballerinalang/compiler/desugar/QueryDesugar.java 85.97% <100.00%> (+0.15%) ⬆️
.../compiler/semantics/analyzer/QueryTypeChecker.java 89.20% <100.00%> (+0.08%) ⬆️
...lang/compiler/semantics/analyzer/TypeResolver.java 89.32% <100.00%> (-0.09%) ⬇️

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -48,6 +48,11 @@ public void testSimpleQueryExprForStringResult() {
Assert.assertEquals(returnValues.toString(), "Alex Ranjan John ");
}

@Test(description = "Test simple query expression with string result")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a negative test for ambiguous types also.

 string:Char[]|string strValue = check from Book _ in bookStream
       select chr;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add it to xml|xml[] case too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests for ambiguous situations in both string,xml.
But those tests will uncomment after fixing #40012

stream<Book, error?> bookStream = [{ author: "Author 1", title: "Title 1" },
{author: "Author 2", title: "Title 2" }].toStream();

xml xmlValue = check from Book book in bookStream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a few positive and negative tests where the expected type is xmlxml:Element, xml:Elemen, xml:Elemen[], var, xmlxml:Text

Copy link
Contributor Author

@SasinduDilshara SasinduDilshara Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added. 35ec756

Copy link
Contributor

@sanjana sanjana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor formatting suggestions.
Look for all places where applicable.

@github-actions
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Apr 18, 2023
@github-actions
Copy link

Closed PR due to inactivity for more than 18 days.

@github-actions
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label May 27, 2023
@github-actions
Copy link

Closed PR due to inactivity for more than 18 days.

@pcnfernando
Copy link
Member

@SasinduDilshara please check on the buld failure

@pcnfernando
Copy link
Member

@sanjana please enable the tests that will be addressed in #40012 once this PR is merged

@github-actions
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Jun 29, 2023
@gimantha gimantha removed the Stale label Jun 30, 2023
@pcnfernando pcnfernando added this to the 2201.8.0 milestone Jul 6, 2023
@pcnfernando pcnfernando merged commit 51103a0 into ballerina-platform:master Jul 10, 2023
17 checks passed
@pcnfernando
Copy link
Member

@SasinduDilshara can you please check and port the fix to applicable patch branches

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.
Projects
None yet
5 participants