Skip to content

Commit 8e614f8

Browse files
ipostanogovjvican
authored andcommitted
Fixes for tour/lower-type-bounds (#989)
1 parent 05de751 commit 8e614f8

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

_ba/tour/lower-type-bounds.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ Kroz sljedeći primjer vidjećemo zašto je ovo korisno:
2222

2323
```tut:fail
2424
trait Node[+B] {
25-
def prepend(elem: B): Unit
25+
def prepend(elem: B): Node[B]
2626
}
2727
2828
case class ListNode[+B](h: B, t: Node[B]) extends Node[B] {
29-
def prepend(elem: B) = ListNode[B](elem, this)
29+
def prepend(elem: B): ListNode[B] = ListNode(elem, this)
3030
def head: B = h
31-
def tail = t
31+
def tail: Node[B] = t
3232
}
3333
3434
case class Nil[+B]() extends Node[B] {
35-
def prepend(elem: B) = ListNode[B](elem, this)
35+
def prepend(elem: B): ListNode[B] = ListNode(elem, this)
3636
}
3737
```
3838

@@ -48,17 +48,17 @@ Ovo radimo uvođenjem novog tipskog parametra `U` koji ima `B` kao svoju donju g
4848

4949
```tut
5050
trait Node[+B] {
51-
def prepend[U >: B](elem: U)
51+
def prepend[U >: B](elem: U): Node[U]
5252
}
5353
5454
case class ListNode[+B](h: B, t: Node[B]) extends Node[B] {
55-
def prepend[U >: B](elem: U) = ListNode[U](elem, this)
55+
def prepend[U >: B](elem: U): ListNode[U] = ListNode(elem, this)
5656
def head: B = h
57-
def tail = t
57+
def tail: Node[B] = t
5858
}
5959
6060
case class Nil[+B]() extends Node[B] {
61-
def prepend[U >: B](elem: U) = ListNode[U](elem, this)
61+
def prepend[U >: B](elem: U): ListNode[U] = ListNode(elem, this)
6262
}
6363
```
6464

_tour/lower-type-bounds.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ Here is an example where this is useful:
2020

2121
```tut:fail
2222
trait Node[+B] {
23-
def prepend(elem: B): Unit
23+
def prepend(elem: B): Node[B]
2424
}
2525
2626
case class ListNode[+B](h: B, t: Node[B]) extends Node[B] {
27-
def prepend(elem: B) = ListNode[B](elem, this)
27+
def prepend(elem: B): ListNode[B] = ListNode(elem, this)
2828
def head: B = h
29-
def tail = t
29+
def tail: Node[B] = t
3030
}
3131
3232
case class Nil[+B]() extends Node[B] {
33-
def prepend(elem: B) = ListNode[B](elem, this)
33+
def prepend(elem: B): ListNode[B] = ListNode(elem, this)
3434
}
3535
```
3636

@@ -46,13 +46,13 @@ trait Node[+B] {
4646
}
4747
4848
case class ListNode[+B](h: B, t: Node[B]) extends Node[B] {
49-
def prepend[U >: B](elem: U) = ListNode[U](elem, this)
49+
def prepend[U >: B](elem: U): ListNode[U] = ListNode(elem, this)
5050
def head: B = h
51-
def tail = t
51+
def tail: Node[B] = t
5252
}
5353
5454
case class Nil[+B]() extends Node[B] {
55-
def prepend[U >: B](elem: U) = ListNode[U](elem, this)
55+
def prepend[U >: B](elem: U): ListNode[U] = ListNode(elem, this)
5656
}
5757
```
5858

0 commit comments

Comments
 (0)