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]: Inline record with closures crashes for fill value cases #40214

Closed
HindujaB opened this issue Apr 12, 2023 · 1 comment · Fixed by #40579
Closed

[Bug]: Inline record with closures crashes for fill value cases #40214

HindujaB opened this issue Apr 12, 2023 · 1 comment · Fixed by #40579
Assignees
Labels
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

@HindujaB
Copy link
Contributor

HindujaB commented Apr 12, 2023

Description

$subject

Steps to Reproduce

import ballerina/io;
public function main() {
    record {|int i = 9;|} b = {}; // passing
    io:println(b);
    final int k = 2;
    record {|int i = k;|}[3] arr = []; // error
    io:println(arr); 
}

error :

[2023-04-12 14:11:01,886] SEVERE {b7a.log.crash} - null 
java.lang.NullPointerException
        at hinduja.record_init_test.0.$typedesc$$anonType$_2.instantiate(hinduja/record_init_test/0/$typedesc$$anonType$_2)
        at io.ballerina.runtime.internal.values.TypedescValueImpl.instantiate(TypedescValueImpl.java:89)
        at io.ballerina.runtime.internal.values.ArrayValueImpl.extractRecordFillerValues(ArrayValueImpl.java:1080)
        at io.ballerina.runtime.internal.values.ArrayValueImpl.fillValues(ArrayValueImpl.java:1064)
        at io.ballerina.runtime.internal.values.ArrayValueImpl.initArrayValues(ArrayValueImpl.java:169)
        at io.ballerina.runtime.internal.values.ArrayValueImpl.<init>(ArrayValueImpl.java:270)
        at io.ballerina.runtime.internal.values.ArrayValueImpl.<init>(ArrayValueImpl.java:261)
        at hinduja.record_init_test.0.test_fail.main(test_fail.bal:326)
        at hinduja.record_init_test.0.$_init.$lambda$main$(record_init_test)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:324)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:291)
        at java.base/java.lang.Thread.run(Thread.java:829)
 

This is due to the closures becoming null.

Affected Version(s)

current master, 2201.4.x, 2201.5.x

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@HindujaB HindujaB added Type/Bug Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime labels Apr 12, 2023
@HindujaB HindujaB changed the title [Bug]: inline record with closures crashes for fill value cases [Bug]: Inline record with closures crashes for fill value cases Apr 12, 2023
@HindujaB HindujaB self-assigned this Jun 28, 2023
Copy link

github-actions bot commented Dec 6, 2023

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 Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

1 participant