You should be able to explicitly downcast the result, and the static type of the reference will decide which path is taken. `InputRangeObject!(ElementType!Range) = inputRangeObject(range);`