Skip to content

Commit e67fed3

Browse files
committed
Revert "Allow to define trait parameters via overrides"
This reverts commit faf8716.
1 parent 5b46900 commit e67fed3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

docs/docs/reference/other-new-features/trait-parameters.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ class D extends C, Greeting("Bill") // error: parameter passed twice
2626
Should this print "Bob" or "Bill"? In fact this program is illegal,
2727
because it violates the second rule of the following for trait parameters:
2828

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`.
3030

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`.
3232

3333
3. Traits must never pass arguments to parent traits.
3434

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-
3735
Here's a trait extending the parameterized trait `Greeting`.
3836

3937
```scala
@@ -53,13 +51,6 @@ The correct way to write `E` is to extend both `Greeting` and
5351
```scala
5452
class E extends Greeting("Bob"), FormalGreeting
5553
```
56-
Alternatively, a class could also define the `name` parameter of `Greeting` using
57-
an override, using rule (4) above:
58-
59-
```scala
60-
class E2 extends FormalGreeting:
61-
override val name: String = "Bob"
62-
```
6354

6455
## Reference
6556

0 commit comments

Comments
 (0)