puffnfresh/wartremover — pull request #46 by tpolecat (2014-01-31 06:56:41+00:00)
Title: candidate unsafe == wart

This is in response to #45.

This wart disables `==` for operands of non-conforming types. It disables, for instance, comparison between `List` and `Set`, but allows comparison between `Option[Int]` and `None`. It would be nice, if the types are not equal, to require the supertype to be abstract; however I have not been able to figure out how to determine this (the `TypeSymbol` always claims to be non-abstract).

Note that implementing this wart for `equals` is, oddly, a different situation. In the expression `(1 max 2) == List(3, 4).map(_ + 1)` the RHS has type `List[Int]`, but for `equals` the RHS is inferred as `Any ?` (which of course conforms with the LHS). Go figure.

Anyway I thought I would throw this out as a starting point.