Skip to content

Commit 300ce07

Browse files
authored
Merge pull request #1141 from f0ster/master
Update upper-type-bounds.md
2 parents f902983 + f80ac35 commit 300ce07

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

_tour/upper-type-bounds.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ val catContainer = new PetContainer[Cat](new Cat)
4444
```
4545

4646
```tut:fail
47-
val lionContainer = new PetContainer[Lion](new Lion) // this would not compile
47+
// this would not compile
48+
val lionContainer = new PetContainer[Lion](new Lion)
4849
```
4950
The `class PetContainer` take a type parameter `P` which must be a subtype of `Pet`. `Dog` and `Cat` are subtypes of `Pet` so we can create a new `PetContainer[Dog]` and `PetContainer[Cat]`. However, if we tried to create a `PetContainer[Lion]`, we would get the following Error:
5051

0 commit comments

Comments
 (0)