File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
docs/docs/reference/new-types Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,18 @@ The type `S & T` represents values that are of the type `S` and `T` at the same
1111
1212``` scala
1313trait Resettable {
14- def reset (): this . type
14+ def reset (): Unit
1515}
1616trait Growable [T ] {
17- def add (x : T ): this . type
17+ def add (t : T ): Unit
1818}
1919def f (x : Resettable & Growable [String ]) = {
2020 x.reset()
2121 x.add(" first" )
2222}
2323```
2424
25- The value ` x ` is required to be _ both_ a ` Resettable ` and a
25+ The parameter ` x ` is required to be _ both_ a ` Resettable ` and a
2626` Growable[String] ` .
2727
2828The members of an intersection type ` A & B ` are all the members of ` A ` and all
@@ -51,8 +51,8 @@ can be further simplified to `List[A & B]` because `List` is
5151covariant.
5252
5353One might wonder how the compiler could come up with a definition for
54- ` children ` of type ` List[A & B] ` since all its is given are ` children `
55- definitions of type ` List[A] ` and ` List[B] ` . The answer is it does not
54+ ` children ` of type ` List[A & B] ` since what is given are ` children `
55+ definitions of type ` List[A] ` and ` List[B] ` . The answer is the compiler does not
5656need to. ` A & B ` is just a type that represents a set of requirements for
5757values of the type. At the point where a value is _ constructed_ , one
5858must make sure that all inherited members are correctly defined.
You can’t perform that action at this time.
0 commit comments