You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/other-new-features/trait-parameters.md
+2-11Lines changed: 2 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -26,14 +26,12 @@ class D extends C, Greeting("Bill") // error: parameter passed twice
26
26
Should this print "Bob" or "Bill"? In fact this program is illegal,
27
27
because it violates the second rule of the following for trait parameters:
28
28
29
-
1. If a class `C`directly extends a parameterized trait `T`, and its superclass does not, `C`_must_ pass arguments to `T`.
29
+
1. If a class `C` extends a parameterized trait `T`, and its superclass does not, `C`_must_ pass arguments to `T`.
30
30
31
-
2. If a class `C`directly or indirectly extends a parameterized trait `T`, and its superclass does as well, `C`_must not_ pass arguments to `T`.
31
+
2. If a class `C` extends a parameterized trait `T`, and its superclass does as well, `C`_must not_ pass arguments to `T`.
32
32
33
33
3. Traits must never pass arguments to parent traits.
34
34
35
-
4. If a class `C` extends a parameterized trait `T` only indirectly, and its superclass does not extend `T`, then all parameters of `T` must be defined via overrides.
36
-
37
35
Here's a trait extending the parameterized trait `Greeting`.
38
36
39
37
```scala
@@ -53,13 +51,6 @@ The correct way to write `E` is to extend both `Greeting` and
53
51
```scala
54
52
classEextendsGreeting("Bob"), FormalGreeting
55
53
```
56
-
Alternatively, a class could also define the `name` parameter of `Greeting` using
0 commit comments