JetBrains/kotlin — pull request #328 by abreslav (2013-12-17 08:38:47+00:00)
Title: First parameter of Map made covariant

This change, though formally correct, it a little controversial, so I want it (conceptually) reviewed.

We make the (read-only) ````Map```` interface co-variant in its first parameter ````K````:

````kotlin
class Map
````

This is correct because, no members of ````Map```` accept ````K```` as an argument, since ````containsKey()```` and ````get()```` both take ````Any?````.

Effectively, this turns a map into something more like a collection of key-value pairs than a lookup dictionary. Your opinions are welcome.

Note that technically we also have the following options:
* Make ````containsKey()```` and ````get()```` take ````K````, henceforth making ````K```` contra-variant (````in````). This differs from Java, but is binary compatible (thanks to erasure).
* Leave ````K```` invariant for no reason other than "counter-intuitiveness" of its co-variance.

Opinions welcome.