-
Notifications
You must be signed in to change notification settings - Fork 751
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 xml:Text
and xmlSequence
equality comparison
#43074
Fix xml:Text
and xmlSequence
equality comparison
#43074
Conversation
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlText.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43074 +/- ##
============================================
+ Coverage 77.30% 77.35% +0.04%
- Complexity 58541 58599 +58
============================================
Files 3460 3460
Lines 220070 220111 +41
Branches 28909 28916 +7
============================================
+ Hits 170136 170273 +137
+ Misses 40524 40423 -101
- Partials 9410 9415 +5 ☔ View full report in Codecov by Sentry. |
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlText.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
langlib/langlib-test/src/test/resources/test-src/xmllib_constrained_test.bal
Outdated
Show resolved
Hide resolved
langlib/langlib-test/src/test/resources/test-src/xmllib_test.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. |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlText.java
Outdated
Show resolved
Hide resolved
langlib/langlib-test/src/test/resources/test-src/valuelib_test.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/jvm/types.bal
Outdated
Show resolved
Hide resolved
tests/jballerina-unit-test/src/test/resources/test-src/jvm/types.bal
Outdated
Show resolved
Hide resolved
@ravinperera00 The build is failing |
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.
LGTM
Purpose
The Ballerina specification states the following regarding
xml:Text
singleton and xml sequences.This means, when an xml sequence contains only children of
xml:Text
type, the sequence belongs to thexml:Text
type and its value should be equal to an xml:Text value with the concatenation of the children of the sequence. The current implementation does not consider the above two values as equal and the changes included in this PR fixes that.Fixes #42836
Approach
xmlSequence
constructor to concatenate adjacentxml:Text
elements into one member.equals
methods of bothXmlSequence
andXmlText
to accept the opposing type as equal if their text values are equal.Samples
The map method will return an xml sequence containing a single
xml:Text
member (generated using the concatenation of the twoxml:Text
elements). This xml sequence will be equal to thexml:Text
value of "abcdef".Check List