Skip to content

Scaladoc: reported type of Map#map #14511

Closed
@jmgimeno

Description

@jmgimeno

The type reported for Map#map in the docs accessible from https://scala-lang.org/api/3.x/scala/collection/immutable/Map.html#map-fffffcb7 is

def map[K2, V2](f: (K, V) => (K2, V2)): Map[K2, V2]

but, if we go to its definition in the linked source file https://github.com/scala/scala/blob/v2.13.6/src/library/scala/collection/Map.scala#L299 we find that the real type is

def map[K2, V2](f: ((K, V)) => (K2, V2)): CC[K2, V2]

which, at least, I find it very confusing.

If I understand untupling correctly, the magic that allows calling a function which receives a tuple with a function with various parameters occurs at the call-site, so the documented type of the method should not change (or maybe this issue in the documentation has nothing to do with it).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions