Skip to content

Commit

Permalink
Fix check for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryamZi committed Nov 21, 2023
1 parent 9041b64 commit 781e3ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3982,7 +3982,10 @@ public void visit(BLangFail failNode, AnalyzerData data) {
if (!data.commonAnalyzerData.errorTypes.empty()) {
BType failExprType = failNode.expr.getBType();
if (failExprType != symTable.semanticError) {
data.commonAnalyzerData.errorTypes.peek().add(types.getErrorTypes(failExprType));
BType errorTypes = types.getErrorTypes(failExprType);
if (errorTypes != symTable.semanticError) {
data.commonAnalyzerData.errorTypes.peek().add(errorTypes);
}
}
}
if (errorExpressionType != symTable.semanticError &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ public void testNegative2() {
int index = 0;
BAssertUtil.validateError(negativeFile2, index++, "type 'string' not allowed here; " +
"expected an 'error' or a subtype of 'error'", 6, 11);
BAssertUtil.validateError(negativeFile2, index++, "incompatible types: expected " +
"'other', found 'string'", 8, 12);
BAssertUtil.validateError(negativeFile2, index++, "invalid error variable; expecting " +
"an error type but found 'string' in type definition", 8, 12);
BAssertUtil.validateError(negativeFile2, index++, "undefined symbol 'd'", 26, 12);
Expand Down

0 comments on commit 781e3ee

Please sign in to comment.