Skip to content

Commit

Permalink
Fixed types-variance.md contravariant example code comment
Browse files Browse the repository at this point in the history
Fixed the second code comment for the last example just before the summary. The words "Book" and "Buyable" needed to be swapped. This makes it consistent with how the first comment uses the term "expected", where "expected" refers to the type you see in the following line of code. The first code comment is referring to the return type in the next line of code. The second comment is referring to the parameter type in the following line of code. Therefore, in the second code comment, "Book" is what is "expected" (by the h type), and "Buyable" is what is "provided" by the f parameter type.
  • Loading branch information
still-dreaming-1 authored Dec 20, 2023
1 parent 1f6ddbf commit 47fabb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _overviews/scala3-book/types-variance.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ val f: Function[Buyable, Buyable] = b => b
// OK to return a Buyable where a Item is expected
val g: Function[Buyable, Item] = f

// OK to provide a Book where a Buyable is expected
// OK to provide a Buyable where a Book is expected
val h: Function[Book, Buyable] = f
```
{% endtab %}
Expand Down

0 comments on commit 47fabb0

Please sign in to comment.