What the `compareLocations` function compares are SourceLocation objects
or strings(based on current usage). There is no case to assume the input
are position objects. Therefore, remove the useless and unreasonable
code.
Relatively, update the tests to indicate the actual usage.