Skip to content

Commit 393dab4

Browse files
committed
Use symbol.showDcl, add sentence on explicitly passing arg
1 parent fc9acd7 commit 393dab4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,9 @@ class MissingImplicitArgument(
27462746
i"\n\nNote: ${s.ref.symbol.showLocated} was not considered because it was not imported with `import given`."
27472747
def noChainConversionsNote(s: Iterable[TermRef]): Option[String] =
27482748
Option.when(s.nonEmpty)(
2749-
i"\n\nNote: Chaining implicit conversions is no longer allowed in Scala. The following conversions were ignored:${s.map(g => "\n - " + g.symbol.showLocated).mkString}"
2749+
i"\n\nNote: Chaining implicit conversions is no longer allowed in Scala. " +
2750+
i"The following conversions were ignored:${s.map(g => s"\n - ${g.symbol.showDcl}").mkString}" +
2751+
i"\nIf there is an implicit `Conversion[A, ${pt.show}]` and an implicit `A` in scope, you need to explicitly pass the argument, e.g. `(using summon[A])`"
27502752
)
27512753
super.msgPostscript
27522754
++ ignoredInstanceNormalImport.map(hiddenImplicitNote)

tests/neg/i16453.check

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
-- [E172] Type Error: tests/neg/i16453.scala:10:43 ---------------------------------------------------------------------
22
10 | val fails = summon[String => Option[Int]] // error
33
| ^
4-
| No given instance of type String => Option[Int] was found for parameter x of method summon in object Predef
4+
|No given instance of type String => Option[Int] was found for parameter x of method summon in object Predef
55
|
6-
| Note: Chaining implicit conversions is no longer allowed in Scala. The following conversions were ignored:
7-
| - given instance given_Conversion_Function_Function
6+
|Note: Chaining implicit conversions is no longer allowed in Scala. The following conversions were ignored:
7+
| - final given def given_Conversion_Function_Function[T]: Conversion[String => T, String => Option[T]]
8+
|If there is an implicit `Conversion[A, String => Option[Int]]` and an implicit `A` in scope, you need to explicitly pass the argument, e.g. `(using summon[A])`

0 commit comments

Comments
 (0)