Tighten up Literal equality testing

Previously raised exception if compared to object of different type rather than fail.