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 compiler crashes when checking the equality between two XML values with interpolation #41981

Closed
nipunayf opened this issue Jan 16, 2024 · 1 comment · Fixed by #41996
Assignees
Labels
Area/Compiler Lang/Expressions/XmlTemplate Priority/Blocker Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug

Comments

@nipunayf
Copy link
Contributor

Description

A compiler crash with the following error is generated when attempting to check the equality between two XML values with interpolated variables.

[2024-01-16 11:46:24,697] SEVERE {b7a.log.crash} - class io.ballerina.runtime.internal.values.XmlSequence cannot be cast to class io.ballerina.runtime.internal.values.XmlText (io.ballerina.runtime.internal.values.XmlSequence and io.ballerina.runtime.internal.values.XmlText are in unnamed module of loader 'app') 
java.lang.ClassCastException: class io.ballerina.runtime.internal.values.XmlSequence cannot be cast to class io.ballerina.runtime.internal.values.XmlText (io.ballerina.runtime.internal.values.XmlSequence and io.ballerina.runtime.internal.values.XmlText are in unnamed module of loader 'app')
        at io.ballerina.runtime.internal.TypeChecker.checkValueEquals(TypeChecker.java:2992)
        at io.ballerina.runtime.internal.TypeChecker.isEqual(TypeChecker.java:2944)
        at io.ballerina.runtime.internal.TypeChecker.isEqual(TypeChecker.java:379)
        at err_xml_equality.main(err_xml_equality.bal:7)
        at $_init.$moduleExecute(.)
        at $_init.$lambda$$moduleExecute$(.)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:306)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:273)
        at java.base/java.lang.Thread.run(Thread.java:833)

Steps to Reproduce

Execute the following Ballerina code.

public function main() {
    string a = "hello";

    xml x1 = xml `AS-${a}`;
    xml x2 = xml `AS-${a}`;

    _ = x1 == x2;
}

Affected Version(s)

Ballerina 2201.8.4 (Swan Lake Update 8)`

OS, DB, other environment details and versions

OS: macOS 14.2.1 23C71
JDK: openjdk 17.0.8 2023-07-18

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

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.

@HindujaB HindujaB added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler Lang/Expressions/XmlTemplate Priority/Blocker Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants