-
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
Changes from all commits
b195ffe
78bd5c5
1dcbc9d
f85f5da
d3fc5b3
3f71383
5be584b
ceb3358
c4375ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,15 +35,14 @@ public class CheckedExprNegativeTest { | |
public void testSemanticErrors() { | ||
CompileResult compile = BCompileUtil.compile( | ||
"test-src/expressions/checkedexpr/checked_expr_semantics_negative.bal"); | ||
Assert.assertEquals(compile.getErrorCount(), 4, compile.toString()); | ||
Assert.assertEquals(compile.getErrorCount(), 5, compile.toString()); | ||
BAssertUtil.validateError(compile, 0, "invalid usage of the 'check' expression " + | ||
"operator: no expression type is equivalent to error type", 11, 25); | ||
BAssertUtil.validateError(compile, 1, "invalid usage of the 'check' expression " + | ||
"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 commentThe reason will be displayed to describe this comment to others. Learn more. Example is here is
The diagnostic is correct, But I think we can improve this. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Created.(#29696) |
||
BAssertUtil.validateError(compile, 2, "incompatible types: expected 'string', found 'never'", 30, 19); | ||
BAssertUtil.validateError(compile, 3, "incompatible types: expected '(string|error)'" + | ||
", found '(string|int)'", 39, 25); | ||
BAssertUtil.validateError(compile, 4, "invalid expression, expected a call expression", 54, 5); | ||
} | ||
|
||
@Test | ||
|
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.