Fix Issue 9616 - SortedRange should support all range kinds

A fork of @andralex's #1184 pull request, since he seems too busy right now.

I've reviewed and approved his pull request, and "would" have pulled, had the unittests passed.

So this pull only "adds" a trivial unittest fix commit. The andralex commits are already "pre-approved". @AndrejMitrovic: Pull when all green?