-
Notifications
You must be signed in to change notification settings - Fork 744
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
Validate expr with check keyword in call stmt #29282
Validate expr with check keyword in call stmt #29282
Conversation
f550bac
to
d3fc5b3
Compare
...er/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java
Outdated
Show resolved
Hide resolved
...ina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/DiagnosticErrorCode.java
Outdated
Show resolved
Hide resolved
...ina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/DiagnosticErrorCode.java
Outdated
Show resolved
Hide resolved
...er/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java
Outdated
Show resolved
Hide resolved
...er/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java
Outdated
Show resolved
Hide resolved
...er/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java
Show resolved
Hide resolved
...er/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java
Show resolved
Hide resolved
ebdf599
to
ceb3358
Compare
Codecov Report
@@ Coverage Diff @@
## master #29282 +/- ##
============================================
+ Coverage 66.77% 68.09% +1.31%
- Complexity 34220 35275 +1055
============================================
Files 2800 2816 +16
Lines 150969 152586 +1617
Branches 18251 18534 +283
============================================
+ Hits 100813 103902 +3089
+ Misses 44161 42528 -1633
- Partials 5995 6156 +161 Continue to review full report at Codecov.
|
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.
Parser changes LGTM
...ina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/DiagnosticErrorCode.java
Outdated
Show resolved
Hide resolved
"operator: all expression types are equivalent to error type", 16, 25); | ||
BAssertUtil.validateError(compile, 2, "invalid usage of the 'check' expression " + | ||
"operator: all expression types are equivalent to error type", 30, 25); | ||
BAssertUtil.validateError(compile, 1, "incompatible types: expected 'string', found 'never'", 16, 19); |
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.
Example is here is
function testCheckedExprSemanticErrors2() returns error? {
string line = checkpanic readLineError();
}
The diagnostic is correct, But I think we can improve this.
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.
@hasithaa Shall I fix this in a separate PR?
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.
yes. Please create an issue, we can fix this later.
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.
Created.(#29696)
compiler/ballerina-parser/src/main/resources/syntax_diagnostic_message.properties
Outdated
Show resolved
Hide resolved
...erina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/TypeChecker.java
Show resolved
Hide resolved
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.
Looks good to me
cfa4b2e
to
c4375ab
Compare
@@ -431,7 +431,6 @@ | |||
|
|||
// Checked expression related errors | |||
CHECKED_EXPR_INVALID_USAGE_NO_ERROR_TYPE_IN_RHS("BCE3030", "checked.expr.invalid.usage.no.error.type.rhs"), | |||
CHECKED_EXPR_INVALID_USAGE_ALL_ERROR_TYPES_IN_RHS("BCE3031", "checked.expr.invalid.usage.only.error.types.rhs"), |
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.
Shall we fix the subsequent diagnostic IDs?
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.
Shall we update this later, This might conflict with other PRs.
Purpose
Fixes #28769
Check List