-
Notifications
You must be signed in to change notification settings - Fork 758
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
Add compiler changes for enabling Error BP in on fail
clause
#40293
Add compiler changes for enabling Error BP in on fail
clause
#40293
Conversation
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Outdated
Show resolved
Hide resolved
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Outdated
Show resolved
Hide resolved
...rina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java
Outdated
Show resolved
Hide resolved
...-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/SemanticAnalyzer.java
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## on-fail-error-bp #40293 +/- ##
======================================================
+ Coverage 77.16% 77.19% +0.02%
- Complexity 54244 54272 +28
======================================================
Files 3340 3340
Lines 201659 201697 +38
Branches 25914 25926 +12
======================================================
+ Hits 155603 155690 +87
+ Misses 37599 37553 -46
+ Partials 8457 8454 -3
☔ View full report in Codecov by Sentry. |
…orm/ballerina-lang into on-fail-compiler
...iler/ballerina-lang/src/main/java/org/ballerinalang/util/diagnostic/DiagnosticErrorCode.java
Show resolved
Hide resolved
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Show resolved
Hide resolved
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Show resolved
Hide resolved
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Show resolved
Hide resolved
compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
Show resolved
Hide resolved
...st/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachNegativeTests.java
Show resolved
Hide resolved
testErrorCode = errCode; | ||
testErrorReason = errReason; | ||
testMessage = msg; | ||
} | ||
assertEquality(testMessage, "error!"); | ||
assertEquality(testErrorCode, 20); | ||
assertEquality(testErrorReason, "deadlock condition"); | ||
assertEquality(testErrorCode is int, true); | ||
assertEquality(testErrorReason is string, true); |
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 wouldn't use module-level variables, won't allow us to properly run these tests concurrently.
How about asserting withing the on fail block and returning there. Then outside we can have something like an assert fail to make sure control was transferred to the on fail block.
return str; | ||
} | ||
|
||
function testOnFailWithUnion () returns string { |
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.
function testOnFailWithUnion () returns string { | |
function testOnFailWithUnion() returns string { |
|
||
@BeforeClass | ||
public void setup() { | ||
programFile = BCompileUtil.compile("test-src/statements/retrystmt/retry_stmt_with_on_fail.bal"); | ||
negativeFile = BCompileUtil.compile("test-src/statements/retrystmt/retry_on_fail_negative.bal"); | ||
negativeFile1 = BCompileUtil.compile("test-src/statements/retrystmt/retry_on_fail_negative.bal"); | ||
negativeFile2 = BCompileUtil.compile("test-src/statements/retrystmt/retry_on_fail_negative_unreachable.bal"); |
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.
Used only in one test method, right? Use a local variable instead.
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.
Add licence header.
How is this file related to your changes?
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.
IMO, the tests are overly complex for the errors we are trying to test. I understand that these are similar to existing tests, but not the easiest to read.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
Review suggestions will be addressed separately. Need to also fix type ErrorTypeA distinct error;
type ErrorTypeB distinct error;
function fn() {
transaction {
var res = checkpanic commit;
fail error ErrorTypeA("oops!", message = "Type A");
} on fail ErrorTypeA e {
}
} Fails with ERROR [temp.bal:(9:15,9:27)] incompatible error definition type: 'error' will not be matched to 'ErrorTypeA'
ERROR [temp.bal:(9:15,9:25)] incompatible types: expected '(error|ErrorTypeA)', found 'ErrorTypeA' |
Purpose
Check List