-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Error about a missing using
clause incorrectly suggests use of -rewrite to fix.
#19872
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
Comments
A test case that details both:
|
Here is a smaller example where Scala 3.4.1 gives this warning. This issue has nothing to do with fastparse. It's just the usage pattern for the context bound. {
def test[A : List] = true // Pretend that List[A] will be an implicit value in context.
test(_)
}
[warn] Context bounds will map to context parameters.
[warn] A `using` clause is needed to pass explicit arguments to them.
[warn] This code can be rewritten automatically under -rewrite -source 3.4-migration.
[warn] test(_)
[warn] ^^^^ The same warning happens with |
Is it exactly the same though? Using the code below and "-source:future", I get the error message:
import fastparse.*
import fastparse.NoWhitespace.*
@main def app: Unit =
def foo[$: P]: P[Unit] = P("bar")
parse("", foo) Running the rewriting rule of 3.4, it adds a import fastparse.*
import fastparse.NoWhitespace.*
@main def app: Unit =
def foo[$: P]: P[Unit] = P("bar")
parse("", using foo) |
Hello! I also ran against this problem but I found a solution that I'm sharing here in case anyone else is still running up against it. I made it work by putting the
|
3.6 message is
The caret points to where the missing implicit would go. If that message is not meaningful, so that you delete the placeholder, then you get the error reported above, it found a context function This ticket is related to #19680 which also turns on a missing |
Compiler version
3.4.0
Minimized example
A code example is not highly relevant to this issue, but you can find one here:
This has to do with using fastparse 3.0.2 with scalac 3.4.0. The message produced only occurs in 3.4.0 and does not occur in 3.3.1 or 3.3.3
Output Error/Warning message
Why this Error/Warning was not helpful
The direction to use the
-rewrite -source 3.4-migration
option isn't applicable or helpful. As you cansee, both these options were provided to the compiler. It rewrote nothing. Furthermore, it is not clear
where this
using
clause should be placed.Suggested improvements
A few ideas:
The text was updated successfully, but these errors were encountered: