Skip to content

Conversation

unkarjedy
Copy link
Contributor

This code doesn't compile and produces error:

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:

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).

This code doesn't compile and produces error:
>[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)`.
@prolativ prolativ merged commit a73a441 into scala:language-reference-stable Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants