File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -325,8 +325,11 @@ class TailRec extends MiniPhase {
325
325
326
326
if isRecursiveCall then
327
327
if ctx.settings.Whas .recurseWithDefault then
328
- if tree.args.exists(_.symbol.name.is(DefaultGetterName )) then
329
- report.warning(RecurseWithDefault (), tree.srcPos)
328
+ tree.args.find(_.symbol.name.is(DefaultGetterName )) match
329
+ case Some (arg) =>
330
+ val DefaultGetterName (_, index) = arg.symbol.name: @ unchecked
331
+ report.warning(RecurseWithDefault (calledMethod.info.firstParamNames(index)), tree.srcPos)
332
+ case _ =>
330
333
331
334
if (inTailPosition) {
332
335
tailrec.println(" Rewriting tail recursive call: " + tree.span)
Original file line number Diff line number Diff line change
1
+ -- [E220] Type Warning: tests/warn/i23541.scala:29:13 ------------------------------------------------------------------
2
+ 29 | println(f(using s = "ab")) // warn uses default instead of given // prints "ab"
3
+ | ^^^^^^^^^^^^^^^^^
4
+ | Argument for implicit parameter i was supplied using a default argument.
5
+ |
6
+ | longer explanation available when compiling with `-explain`
7
+ -- [E221] Type Warning: tests/warn/i23541.scala:5:17 -------------------------------------------------------------------
8
+ 5 | else fun(x - 1)(using p = p + x) // warn recurse uses default (instead of given passed down the stack)
9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
10
+ | Recursive call used a default argument for parameter q.
11
+ |
12
+ | longer explanation available when compiling with `-explain`
13
+ -- [E221] Type Warning: tests/warn/i23541.scala:9:17 -------------------------------------------------------------------
14
+ 9 | else gun(x - 1)(p = p + x) // warn recurse uses default (value not passed down the stack)
15
+ | ^^^^^^^^^^^^^^^^^^^^^
16
+ | Recursive call used a default argument for parameter q.
17
+ |
18
+ | longer explanation available when compiling with `-explain`
You can’t perform that action at this time.
0 commit comments