-
Notifications
You must be signed in to change notification settings - Fork 744
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
Fix several CCE issues in query expressions that has string and xml types as the expected type. #40041
Conversation
Codecov ReportPatch coverage:
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
☔ View full report in Codecov by Sentry. |
tests/jballerina-unit-test/src/test/resources/test-src/query/string-query-expression.bal
Show resolved
Hide resolved
@@ -48,6 +48,11 @@ public void testSimpleQueryExprForStringResult() { | |||
Assert.assertEquals(returnValues.toString(), "Alex Ranjan John "); | |||
} | |||
|
|||
@Test(description = "Test simple query expression with string result") |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/QueryDesugar.java
Outdated
Show resolved
Hide resolved
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added. 35ec756
There was a problem hiding this 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.
tests/jballerina-unit-test/src/test/resources/test-src/query/string-query-expression.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/string-query-expression.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/string-query-expression.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/xml-query-expression.bal
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/xml-query-expression.bal
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/xml-query-expression.bal
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/xml-query-expression.bal
Show resolved
Hide resolved
...-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/QueryTypeChecker.java
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
...allerina-unit-test/src/test/java/org/ballerinalang/test/query/StringQueryExpressionTest.java
Show resolved
Hide resolved
.../jballerina-unit-test/src/test/resources/test-src/query/string-query-expression-negative.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/string-query-expression.bal
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/query/xml-query-expression.bal
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
@SasinduDilshara please check on the buld failure |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
…ina-lang into issue_39641_changes
@SasinduDilshara can you please check and port the fix to applicable patch branches |
Purpose
Fixes #39641
Fixes #40029
Fixes #40030
Fixes #40038
Check List