Skip to content

Commit b53c855

Browse files
committed
chore: add flag to disable the warning in the error message
1 parent 7b64d20 commit b53c855

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Migrations.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ trait Migrations:
132132
if tp.companion == ImplicitMethodType && pt.applyKind != ApplyKind.Using && pt.args.nonEmpty then
133133
val rewriteMsg = Message.rewriteNotice("This code", mversion.patchFrom)
134134
report.errorOrMigrationWarning(
135-
em"Implicit parameters should be provided with a `using` clause.$rewriteMsg",
135+
em"""Implicit parameters should be provided with a `using` clause.$rewriteMsg
136+
|To disable the warning, please use the following option:
137+
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
138+
|""",
136139
pt.args.head.srcPos, mversion)
137140
if mversion.needsPatch then
138141
patch(Span(pt.args.head.span.start), "using ")

tests/neg/i22440.check

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
| ^
44
| Implicit parameters should be provided with a `using` clause.
55
| This code can be rewritten automatically under -rewrite -source 3.7-migration.
6+
| To disable the warning, please use the following option:
7+
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"

tests/pos/i22440.scala

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//> using options "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
2+
3+
def foo(implicit x: Int) = x
4+
val _ = foo(1) // warn

tests/warn/i22440.check

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
| ^
44
| Implicit parameters should be provided with a `using` clause.
55
| This code can be rewritten automatically under -rewrite -source 3.7-migration.
6+
| To disable the warning, please use the following option:
7+
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"

0 commit comments

Comments
 (0)