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

[2201.10.x] Desugar field access expression to if statement expression #43773

Conversation

rdulmina
Copy link
Contributor

@rdulmina rdulmina commented Jan 28, 2025

Purpose

$title

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 28, 2025
@rdulmina rdulmina force-pushed the Improve-optional-field-access-desugar branch from 3d9d898 to 9cf77d2 Compare January 28, 2025 11:51
@rdulmina
Copy link
Contributor Author

Closing as opened a new one for the same purpose

@rdulmina rdulmina closed this Jan 29, 2025
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.

2 participants