8000 Implicit parameters should warn at call site in >= 3.7 by hamzaremmal · Pull Request #22441 · scala/scala3 · GitHub
[go: up one dir, main page]

Skip to content

Implicit parameters should warn at call site in >= 3.7 #22441

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

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: add flag to disable the warning in the error message
  • Loading branch information
hamzaremmal committed Feb 6, 2025
commit b53c8557b02c58486d04a4f68b0b577d72a29569
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Migrations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ trait Migrations:
if tp.companion == ImplicitMethodType && pt.applyKind != ApplyKind.Using && pt.args.nonEmpty then
val rewriteMsg = Message.rewriteNotice("This code", mversion.patchFrom)
report.errorOrMigrationWarning(
em"Implicit parameters should be provided with a `using` clause.$rewriteMsg",
em"""Implicit parameters should be provided with a `using` clause.$rewriteMsg
|To disable the warning, please use the following option:
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
|""",
pt.args.head.srcPos, mversion)
if mversion.needsPatch then
patch(Span(pt.args.head.span.start), "using ")
Expand Down
2 changes: 2 additions & 0 deletions tests/neg/i22440.check
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
| ^
| Implicit parameters should be provided with a `using` clause.
| This code can be rewritten automatically under -rewrite -source 3.7-migration.
| To disable the warning, please use the following option:
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
4 changes: 4 additions & 0 deletions tests/pos/i22440.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//> using options "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"

def foo(implicit x: Int) = x
val _ = foo(1) // warn
2 changes: 2 additions & 0 deletions tests/warn/i22440.check
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
| ^
| Implicit parameters should be provided with a `using` clause.
| This code can be rewritten automatically under -rewrite -source 3.7-migration.
| To disable the warning, please use the following option:
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
Loading
0