Skip to content

Commit a73a441

Browse files
authored
trait-parameters.md: delete invalid code from example (#16516)
This code doesn't compile and produces error: ```scala class F(using iname: ImpliedName) extends Object, ImpliedGreeting(using iname), ImpliedFormalGreeting(using iname) ``` >[error] 15 | ImpliedFormalGreeting(using iname) >[error] | ^^^^^^^^^^^^^^^^^^^^^ >[error] |constructor ImpliedFormalGreeting in trait ImpliedFormalGreeting does not take more parameters >[error] |---------------------------------------------------------------------------- >[error] | Explanation (enabled by `-explain`) >[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >[error] | You have specified more parameter lists than defined in the method definition(s). This will compile: ```scala class F(using iname: ImpliedName) extends Object, ImpliedGreeting(using iname), ImpliedFormalGreeting ``` I understand, that maybe this is kinda pseudo-code. >The definition of `F` in the last line is implicitly expanded to But if it's stated that the original code will be "expanded" it sounds as if it we could do it ourselves manually and that would be effectively the same code. An alternative to deleting `(using iname)` could be commenting it out `//(using iname)`.
2 parents 80b2841 + a6d06ad commit a73a441

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The definition of `F` in the last line is implicitly expanded to
7979
class F(using iname: ImpliedName) extends
8080
Object,
8181
ImpliedGreeting(using iname),
82-
ImpliedFormalGreeting(using iname)
82+
ImpliedFormalGreeting
8383
```
8484
Note the inserted reference to the super trait `ImpliedGreeting`, which was not mentioned explicitly.
8585

0 commit comments

Comments
 (0)