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

Fix getting non-accessible symbol error for error intersections with details #42876

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

dulajdilshan
Copy link
Contributor

@dulajdilshan dulajdilshan commented Jun 7, 2024

Purpose

$title

Fixes #42806

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

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

@dulajdilshan dulajdilshan added this to the 2201.10.0 milestone Jun 7, 2024
@dulajdilshan dulajdilshan added Area/Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.68%. Comparing base (cd5bd3b) to head (6eed512).
Report is 113 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #42876      +/-   ##
============================================
+ Coverage     77.31%   77.68%   +0.36%     
- Complexity    51370    51479     +109     
============================================
  Files          2933     2933              
  Lines        204534   204243     -291     
  Branches      26717    26721       +4     
============================================
+ Hits         158134   158658     +524     
+ Misses        37804    36959     -845     
- Partials       8596     8626      +30     

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

Comment on lines 52 to 54
if code != () {
if {code} != actual.detail() {
panic error("expected error detail: '"
+ {code}.toString() + "' found: '"
+ actual.detail().toString() + "'");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just directly assert the code without going through a mapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we have to cast it right? Which way is better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cast is okay here.

Copy link
Contributor Author

@dulajdilshan dulajdilshan Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

if code != () {
    record {|int code;|} detail = (<error<record {|int code;|}>>actual).detail();
    if code != detail.code {
        panic error("expected code: '"
                + code.toString() + "' found: '"
                + detail.code.toString() + "'");
    }
}

Wouldn't it be a longer casting and we may need to have another variable for more readability?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do record {|int code;|} detail = <record {|int code;|} & readonly> actual.detail(); or var on LHS.

Can also use a string template to avoid toString.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 99cd23a

@dulajdilshan dulajdilshan merged commit af69b2f into ballerina-platform:master Jul 1, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler 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.

[Bug]: Getting non-accessible symbol error for error intersections with details
3 participants