Skip to content

Commit

Permalink
Get rid of BOrderedTypeVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
lochana-chathura committed Oct 21, 2024
1 parent 01fc6e4 commit 34a6cec
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 464 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public void visit(BLangOrderByClause orderByClause, TypeChecker.AnalyzerData dat
orderByClause.env = data.commonAnalyzerData.queryEnvs.peek();
for (OrderKeyNode orderKeyNode : orderByClause.getOrderKeyList()) {
BType exprType = checkExpr((BLangExpression) orderKeyNode.getOrderKey(), orderByClause.env, data);
if (exprType.tag != TypeTags.SEMANTIC_ERROR && !types.isOrderedType(exprType, false)) {
if (exprType.tag != TypeTags.SEMANTIC_ERROR && !types.isOrderedType(exprType)) {
dlog.error(((BLangOrderKey) orderKeyNode).expression.pos, DiagnosticErrorCode.ORDER_BY_NOT_SUPPORTED);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2060,8 +2060,7 @@ public BSymbol getBinaryComparisonOpForTypeSets(OperatorKind opKind, BType lhsTy
case LESS_EQUAL:
case GREATER_THAN:
case GREATER_EQUAL:
validOrderedTypesExist = types.isOrderedType(lhsType, false) &&
types.isOrderedType(rhsType, false) && types.isSameOrderedType(lhsType, rhsType);
validOrderedTypesExist = types.comparable(lhsType, rhsType);
break;
default:
return symTable.notFoundSymbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7618,7 +7618,7 @@ private void checkArrayLibSortFuncArgs(BLangInvocation iExpr) {

BLangExpression arrExpr = argExprs.get(0);
BType arrType = arrExpr.getBType();
boolean isOrderedType = types.isOrderedType(arrType, false);
boolean isOrderedType = types.isOrderedType(arrType);
if (keyFunction == null) {
if (!isOrderedType) {
dlog.error(arrExpr.pos, DiagnosticErrorCode.INVALID_SORT_ARRAY_MEMBER_TYPE, arrType);
Expand Down Expand Up @@ -7658,7 +7658,7 @@ private void checkArrayLibSortFuncArgs(BLangInvocation iExpr) {
returnType = keyLambdaFunction.function.getBType().getReturnType();
}

if (!types.isOrderedType(returnType, false)) {
if (!types.isOrderedType(returnType)) {
dlog.error(pos, DiagnosticErrorCode.INVALID_SORT_FUNC_RETURN_TYPE, returnType);
}
}
Expand Down
Loading

0 comments on commit 34a6cec

Please sign in to comment.