Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop reference to implicit conversion from named to regular tuples #22015

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/_docs/reference/other-new-features/named-tuples.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ val x: (String, Int) = Bob.toTuple // ok
```
`toTuple` is defined as an extension method in the `NamedTuple` object.
It returns the given tuple unchanged and simply "forgets" the names.

<!--
A `.toTuple` selection is inserted implicitly by the compiler if it encounters a named tuple but the expected type is a regular tuple. So the following works as well:
```scala
val x: (String, Int) = Bob // works, expanded to Bob.toTuple
Expand All @@ -63,6 +63,7 @@ We would need an explicit `_.toTuple` selection to express this:
```scala
val pairs: List[(String, Int)] = persons.map(_.toTuple)
```
-->
Note that conformance rules for named tuples are analogous to the rules for named parameters. One can assign parameters by position to a named parameter list.
```scala
def f(param: Int) = ...
Expand Down
Loading