@@ -36,6 +36,7 @@ import annotation.threadUnsafe
36
36
37
37
import scala .util .control .NonFatal
38
38
import dotty .tools .dotc .inlines .Inlines
39
+ import dotty .tools .dotc .util .chaining .*
39
40
40
41
object Applications {
41
42
import tpd .*
@@ -602,7 +603,7 @@ trait Applications extends Compatibility {
602
603
fail(TypeMismatch (methType.resultType, resultType, None ))
603
604
604
605
// match all arguments with corresponding formal parameters
605
- if success then matchArgs(orderedArgs, methType.paramInfos, n= 0 )
606
+ if success then matchArgs(orderedArgs, methType.paramInfos, n = 0 )
606
607
case _ =>
607
608
if (methType.isError) ok = false
608
609
else fail(em " $methString does not take parameters " )
@@ -757,20 +758,18 @@ trait Applications extends Compatibility {
757
758
}
758
759
else defaultArgument(normalizedFun, n, testOnly)
759
760
760
- // a bug allowed empty parens to expand to implicit args, offer rewrite only on migration
761
+ // a bug allowed empty parens to expand to implicit args: fail empty args for rewrite on migration
761
762
def canSupplyImplicits = methodType.isImplicitMethod
762
- && (applyKind == ApplyKind .Using || {
763
- if args1 .isEmpty then
763
+ && (applyKind == ApplyKind .Using || false .tap : _ =>
764
+ if Application . this .args .isEmpty then
764
765
fail(MissingImplicitParameterInEmptyArguments (methodType.paramNames(n), methString))
765
- true
766
- })
767
- && ctx.mode.is(Mode .ImplicitsEnabled )
766
+ )
768
767
769
768
if ! defaultArg.isEmpty then
770
769
defaultArg.tpe.widen match
771
770
case _ : MethodOrPoly if testOnly => matchArgs(args1, formals1, n + 1 )
772
771
case _ => matchArgs(args1, addTyped(treeToArg(defaultArg)), n + 1 )
773
- else if methodType.isContextualMethod && ctx.mode.is(Mode .ImplicitsEnabled ) || canSupplyImplicits then
772
+ else if ( methodType.isContextualMethod || canSupplyImplicits) && ctx.mode.is(Mode .ImplicitsEnabled ) then
774
773
val implicitArg = implicitArgTree(formal, appPos.span)
775
774
matchArgs(args1, addTyped(treeToArg(implicitArg)), n + 1 )
776
775
else
@@ -1190,8 +1189,7 @@ trait Applications extends Compatibility {
1190
1189
retry = true
1191
1190
rewrites.Rewrites .patch(tree.span.withStart(tree.span.point), " " ) // f() -> f
1192
1191
Diagnostic .Warning (err.msg, err.pos)
1193
- else
1194
- err
1192
+ else err
1195
1193
case _ => err
1196
1194
case dia => dia
1197
1195
retry
0 commit comments