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

[Master] Desugar field access expression to if statement expression #43782

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rdulmina
Copy link
Contributor

Purpose

$title

Fixes #43769

Approach

Desugared field access expression to the following structure

// Before :
type A {
  B b;
}
type B {
 int c;
}
int? res = a?.b?.c

// After desugar :
any|error temp_result;
temp_result = a;
if temp_result !is error? {
    temp_result = (<A> temp_result).b;
    if temp_result !is error? {
        temp_result = (<B> temp_result).c;
    }
}
int? res = <int> temp_result;
 

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@rdulmina rdulmina added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Jan 30, 2025
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@a6e4f99). Learn more about missing BASE report.
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #43782   +/-   ##
=========================================
  Coverage          ?   77.39%           
  Complexity        ?    58627           
=========================================
  Files             ?     3446           
  Lines             ?   219260           
  Branches          ?    28981           
=========================================
  Hits              ?   169701           
  Misses            ?    40120           
  Partials          ?     9439           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chiranSachintha
Copy link
Member

We need to add this changes to 11.x branch as well.

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

Successfully merging this pull request may close these issues.

[Improvement]: Improve field access expression desugar
2 participants