-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strange error for missing using
keyword in implicit argument
#19680
Comments
The message is not wrong, but it would be nice to use the
It would also be nice for the more usual failure case where there is no given in scope.
Migrating a code base from |
I think this is a very special case, and one that would likely detract from the true source of errors in 99.9% of the cases. So I am against making a special "did you mean" for this. On the other hand, even without the implicit parameter complication, the error message is a bit baffling:
Where does the
Or alternatively, show the full expanded call (but this might become very large sometimes). |
The challenge is to report something in brief (and not under Maybe just for the case of "arg of correct type for some parameter in the expression (but perhaps lacks The required type is just misdirection. (Reminiscent of errors from the days of postfixOps, a puzzler.) I don't know if OP is in 0.1% of users. |
Further minimized: class Config()
def renderWebsite(path: String)(using config: Config): String = ???
def renderWidget(using Config): Unit = renderWebsite("/tmp")(Config())
Note that if there is no class Config()
def renderWebsite(path: String)(using config: Config): String = ???
def renderWidget2: Unit = renderWebsite("/tmp")(Config())
And here is the error stack trace, for the first case, with the
|
This issue was picked for the Issue Spree of March 19th, 2024. @mbovel, @iusildra, @jan-pieter will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
It's not clear to me how the info about the expected type should flow from |
My PR unfortunately currently only adds the message under |
…#20023) Started during the last spree with @jan-pieter and @iusildra. Fixes #19680.
Compiler version
3.3.1 and 3.4.0-RC4.
Minimized example
Output Error/Warning message
Why this Error/Warning was not helpful
Obviously the error message is wrong.
Suggested improvement
It should remind me removing the whole argument or adding keyword
using
in line 6.The text was updated successfully, but these errors were encountered: