Skip to content

Commit 76c826d

Browse files
committed
Update message to be more generic
1 parent 6bded27 commit 76c826d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,10 +2745,10 @@ class MissingImplicitArgument(
27452745
def hiddenImplicitNote(s: SearchSuccess) =
27462746
i"\n\nNote: ${s.ref.symbol.showLocated} was not considered because it was not imported with `import given`."
27472747
def noChainConversionsNote(ignoredConversions: Iterable[TermRef]): Option[String] =
2748-
Option.when(s.nonEmpty)(
2749-
i"\n\nNote: Chaining implicit conversions are not allowed in Scala. " +
2750-
i"The following conversions are in scope:${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 can explicitly pass the argument, e.g. `(using summon[A])`"
2748+
Option.when(ignoredConversions.nonEmpty)(
2749+
i"\n\nNote: implicit conversions are not automatically applied to implicit arguments. " +
2750+
i"You will have to pass the argument explicitly.\n" +
2751+
i"The following conversions in scope result in ${pt.show}: ${ignoredConversions.map(g => s"\n - ${g.symbol.showDcl}").mkString}"
27522752
)
27532753
super.msgPostscript
27542754
++ ignoredInstanceNormalImport.map(hiddenImplicitNote)

tests/neg/i16453.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
| ^
44
|No given instance of type Option[Int] was found for parameter x of method summon in object Predef
55
|
6-
|Note: Chaining implicit conversions are not allowed in Scala. The following conversions are in scope:
6+
|Note: implicit conversions are not automatically applied to implicit arguments. You will have to pass the argument explicitly.
7+
|The following conversions in scope result in Option[Int]:
78
| - final given def given_Conversion_T_Option[T]: Conversion[T, Option[T]]
89
| - implicit def toOption[T](t: T): Option[T]
9-
|If there is an implicit `Conversion[A, Option[Int]]` and an implicit `A` in scope, you can explicitly pass the argument, e.g. `(using summon[A])`
1010
-- [E172] Type Error: tests/neg/i16453.scala:15:25 ---------------------------------------------------------------------
1111
15 | implicitly[Option[Int]] // error
1212
| ^
1313
|No given instance of type Option[Int] was found for parameter e of method implicitly in object Predef
1414
|
15-
|Note: Chaining implicit conversions are not allowed in Scala. The following conversions are in scope:
15+
|Note: implicit conversions are not automatically applied to implicit arguments. You will have to pass the argument explicitly.
16+
|The following conversions in scope result in Option[Int]:
1617
| - final given def given_Conversion_T_Option[T]: Conversion[T, Option[T]]
1718
| - implicit def toOption[T](t: T): Option[T]
18-
|If there is an implicit `Conversion[A, Option[Int]]` and an implicit `A` in scope, you can explicitly pass the argument, e.g. `(using summon[A])`

0 commit comments

Comments
 (0)