From fdb33a812fb74de1895d5b245ed543e873a39f82 Mon Sep 17 00:00:00 2001 From: som-snytt Date: Thu, 4 Apr 2024 08:31:27 -0700 Subject: [PATCH] More words in message Co-authored-by: Guillaume Martres --- .../dotty/tools/dotc/reporting/messages.scala | 2 +- tests/warn/i16743.check | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index bcdf65873008..63a8ed1e21fe 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -2456,7 +2456,7 @@ class ExtensionNullifiedByMember(method: Symbol, target: Symbol)(using Context) def kind = MessageKind.PotentialIssue def msg(using Context) = i"""Extension method ${hl(method.name.toString)} will never be selected - |because ${hl(target.name.toString)} already has a member with the same name.""" + |because ${hl(target.name.toString)} already has a member with the same name and compatible parameter types.""" def explain(using Context) = i"""An extension method can be invoked as a regular method, but if that is intended, |it should not be defined as an extension. diff --git a/tests/warn/i16743.check b/tests/warn/i16743.check index a81b322e8016..3010338cfb45 100644 --- a/tests/warn/i16743.check +++ b/tests/warn/i16743.check @@ -2,83 +2,83 @@ 30 | def t = 27 // warn | ^ | Extension method t will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:32:6 -------------------------------------------------------- 32 | def g(x: String)(i: Int): String = x*i // warn | ^ | Extension method g will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:33:6 -------------------------------------------------------- 33 | def h(x: String): String = x // warn | ^ | Extension method h will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:35:6 -------------------------------------------------------- 35 | def j(x: Any, y: Int): String = (x.toString)*y // warn | ^ | Extension method j will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:36:6 -------------------------------------------------------- 36 | def k(x: String): String = x // warn | ^ | Extension method k will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:38:6 -------------------------------------------------------- 38 | def m(using String): String = "m" + summon[String] // warn | ^ | Extension method m will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:39:6 -------------------------------------------------------- 39 | def n(using String): String = "n" + summon[String] // warn | ^ | Extension method n will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:40:6 -------------------------------------------------------- 40 | def o: String = "42" // warn | ^ | Extension method o will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:41:6 -------------------------------------------------------- 41 | def u: Int = 27 // warn | ^ | Extension method u will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:44:6 -------------------------------------------------------- 44 | def at: Int = 42 // warn | ^ | Extension method at will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:46:6 -------------------------------------------------------- 46 | def x(using String)(n: Int): Int = summon[String].toInt + n // warn | ^ | Extension method x will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain` -- [E194] Potential Issue Warning: tests/warn/i16743.scala:47:6 -------------------------------------------------------- 47 | def y(using String)(s: String): String = s + summon[String] // warn | ^ | Extension method y will never be selected - | because T already has a member with the same name. + | because T already has a member with the same name and compatible parameter types. | | longer explanation available when compiling with `-explain`