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

Runtime CCE for field-access-expr #36988

Open
SandaruJayawardana opened this issue Jul 14, 2022 · 3 comments
Open

Runtime CCE for field-access-expr #36988

SandaruJayawardana opened this issue Jul 14, 2022 · 3 comments
Labels
Area/Desugar Issue related Desugar and Code optimizer #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@SandaruJayawardana
Copy link
Contributor

Description:
$title.

public function main() returns error? {
    map<map<map<json>>> x2 = {a: {a: {a: 2}}, b: {a: {c: "string"}}};
    json|error y2 = (x2.c).b;
}

Error:

Running executable

[2022-07-14 11:38:52,370] SEVERE {b7a.log.crash} - class io.ballerina.runtime.internal.values.ErrorValue cannot be cast to class io.ballerina.runtime.internal.values.MapValue (io.ballerina.runtime.internal.values.ErrorValue and io.ballerina.runtime.internal.values.MapValue are in unnamed module of loader 'app') 
java.lang.ClassCastException: class io.ballerina.runtime.internal.values.ErrorValue cannot be cast to class io.ballerina.runtime.internal.values.MapValue (io.ballerina.runtime.internal.values.ErrorValue and io.ballerina.runtime.internal.values.MapValue are in unnamed module of loader 'app')
        at test.main(test.bal:3)
        at $_init.$lambda$main$(.)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(Scheduler.java:594)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:321)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:288)
        at java.base/java.lang.Thread.run(Thread.java:834)

Affected Versions:
Current master

@SandaruJayawardana SandaruJayawardana added Type/Bug Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime labels Jul 14, 2022
@gabilang gabilang added this to To do in Sprint 61 - JBallerina Runtime via automation Jul 28, 2022
@gabilang gabilang moved this from To do to In progress in Sprint 61 - JBallerina Runtime Aug 5, 2022
@gabilang
Copy link
Contributor

It looks like this is happening due to some issues while desugaring map<map<map<json>>> (or higher orders) for field access. So, need to be looked at from front-end. Hence, removing the jBallerina tag.

@gabilang gabilang added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/Desugar Issue related Desugar and Code optimizer #Compiler and removed Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime labels Aug 12, 2022
@gabilang gabilang removed their assignment Aug 12, 2022
@SandaruJayawardana
Copy link
Contributor Author

Similar behavior in optional-field-access-expr also.

@MaryamZi
Copy link
Member

Works as expected on Swan Lake Update 3 RCs. Keeping the issue open to add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Desugar Issue related Desugar and Code optimizer #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
None yet
Development

No branches or pull requests

3 participants