Skip to content

Commit

Permalink
chore: add flag to disable the warning in the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Feb 6, 2025
1 parent 7b64d20 commit b53c855
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
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"

0 comments on commit b53c855

Please sign in to comment.