-
Notifications
You must be signed in to change notification settings - Fork 736
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
Fix getting non-accessible symbol error for error intersections with details #42876
Conversation
...r/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java
Outdated
Show resolved
Hide resolved
...r/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
...r/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java
Outdated
Show resolved
Hide resolved
...r/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java
Outdated
Show resolved
Hide resolved
...-unit-test/src/test/java/org/ballerinalang/test/types/intersection/IntersectionTypeTest.java
Show resolved
Hide resolved
...ces/test-src/types/intersection/error-intersection-access/error_intersection_access_test.bal
Outdated
Show resolved
Hide resolved
...r/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java
Outdated
Show resolved
Hide resolved
...-unit-test/src/test/java/org/ballerinalang/test/types/intersection/IntersectionTypeTest.java
Show resolved
Hide resolved
...ces/test-src/types/intersection/error-intersection-access/error_intersection_access_test.bal
Outdated
Show resolved
Hide resolved
...ces/test-src/types/intersection/error-intersection-access/error_intersection_access_test.bal
Outdated
Show resolved
Hide resolved
...ces/test-src/types/intersection/error-intersection-access/error_intersection_access_test.bal
Outdated
Show resolved
Hide resolved
if code != () { | ||
if {code} != actual.detail() { | ||
panic error("expected error detail: '" | ||
+ {code}.toString() + "' found: '" | ||
+ actual.detail().toString() + "'"); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cast is okay here.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 99cd23a
Purpose
$title
Fixes #42806
Approach
Samples
Remarks
Check List