Skip to content

Commit

Permalink
apply feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Aug 29, 2024
1 parent 7323b9c commit 86e5674
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/standard/Sort.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,23 @@ proc chpl_check_comparator(comparator,
const keydata = comparator.key(data);
type keytype = keydata.type;
if !(canResolve("<", keydata, keydata)) then
compilerError(errorDepth=errorDepth, "The key method in ", comparator.type:string, " must return an object that supports the '<' function when used with ", eltType:string, " elements");
compilerError(errorDepth=errorDepth,
"The key method in ",
comparator.type:string,
" must return an object that supports the '<' function when used with ",
eltType:string,
" elements");

// Check that there isn't also a compare or keyPart
if canResolveMethod(comparator, "compare", data, data) {
compilerError(errorDepth=errorDepth, comparator.type:string, " contains both a key method and a compare method");
compilerError(errorDepth=errorDepth,
comparator.type:string,
" contains both a key method and a compare method");
}
if canResolveMethod(comparator, "keyPart", data, 0) {
compilerError(errorDepth=errorDepth, comparator.type:string, " contains both a key method and a keyPart method");
compilerError(errorDepth=errorDepth,
comparator.type:string,
" contains both a key method and a keyPart method");
}
}
else if canResolveMethod(comparator, "compare", data, data) {
Expand Down Expand Up @@ -3478,7 +3487,7 @@ interface keyPartComparator {

/*
Defines a comparison between two elements of the same type. This method is
not required to be implemented by comparator's that implement the
not required to be implemented by comparators that implement the
:interface:`keyPartComparator` interface.
:arg x: the first element to compare
Expand Down

0 comments on commit 86e5674

Please sign in to comment.