Skip to content

Commit b8df6aa

Browse files
committed
refactor: align "given instance" language instead of implicit
This changes some of the remaining messages that warn about "no implicit" to the new verbiage of "no given instance". fixes #7710
1 parent 5587767 commit b8df6aa

24 files changed

+61
-63
lines changed

compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,13 @@ class ImplicitSearchError(
306306

307307
private def location(preposition: String) = if (where.isEmpty) "" else s" $preposition $where"
308308

309-
private def defaultAmbiguousImplicitMsg(ambi: AmbiguousImplicits) = {
310-
formatMsg(s"ambiguous implicit arguments: ${ambi.explanation}${location("of")}")(
311-
s"ambiguous implicit arguments of type ${pt.show} found${location("for")}"
309+
private def defaultAmbiguousImplicitMsg(ambi: AmbiguousImplicits) =
310+
formatMsg(s"ambiguous given instances: ${ambi.explanation}${location("of")}")(
311+
s"ambiguous given instances of type ${pt.show} found${location("for")}"
312312
)
313-
}
314313

315-
private def defaultImplicitNotFoundMessage = {
316-
ex"no implicit argument of type $pt was found${location("for")}"
317-
}
314+
private def defaultImplicitNotFoundMessage =
315+
ex"no given instance of type $pt was found${location("for")}"
318316

319317
/** Construct a custom error message given an ambiguous implicit
320318
* candidate `alt` and a user defined message `raw`.

tests/neg-custom-args/i13838.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Error: tests/neg-custom-args/i13838.scala:10:5 ----------------------------------------------------------------------
22
10 | foo // error
33
| ^
4-
|no implicit argument of type Order[X] was found for parameter x$1 of method foo in object FooT
4+
|no given instance of type Order[X] was found for parameter x$1 of method foo in object FooT
55
|
66
|where: X is a type variable
77
|.

tests/neg-macros/i6436.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Error: tests/neg-macros/i6436.scala:5:9 -----------------------------------------------------------------------------
22
5 | case '{ StringContext(${Varargs(parts)}*) } => // error
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| no implicit argument of type scala.quoted.Quotes was found
4+
| no given instance of type scala.quoted.Quotes was found
55
-- [E006] Not Found Error: tests/neg-macros/i6436.scala:6:34 -----------------------------------------------------------
66
6 | val ps: Seq[Expr[String]] = parts // error
77
| ^^^^^

tests/neg-macros/i9014b.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
-- Error: tests/neg-macros/i9014b/Test_2.scala:1:23 --------------------------------------------------------------------
33
1 |val tests = summon[Bar] // error
44
| ^
5-
| no implicit argument of type Bar was found for parameter x of method summon in object Predef.
6-
| I found:
5+
| no given instance of type Bar was found for parameter x of method summon in object Predef.
6+
| I found:
77
|
8-
| given_Bar
8+
| given_Bar
99
|
10-
| But given instance given_Bar does not match type Bar.
10+
| But given instance given_Bar does not match type Bar.

tests/neg-scalajs/jsconstructortag-error-in-typer.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:9:39 -------------------------------------------------
22
9 | val a = js.constructorTag[ScalaClass] // error
33
| ^
4-
|no implicit argument of type scala.scalajs.js.ConstructorTag[ScalaClass] was found for parameter tag of method constructorTag in package scala.scalajs.js.
4+
|no given instance of type scala.scalajs.js.ConstructorTag[ScalaClass] was found for parameter tag of method constructorTag in package scala.scalajs.js.
55
|I found:
66
|
77
| scala.scalajs.js.ConstructorTag.materialize[T]
@@ -10,7 +10,7 @@
1010
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:10:39 ------------------------------------------------
1111
10 | val b = js.constructorTag[ScalaTrait] // error
1212
| ^
13-
|no implicit argument of type scala.scalajs.js.ConstructorTag[ScalaTrait] was found for parameter tag of method constructorTag in package scala.scalajs.js.
13+
|no given instance of type scala.scalajs.js.ConstructorTag[ScalaTrait] was found for parameter tag of method constructorTag in package scala.scalajs.js.
1414
|I found:
1515
|
1616
| scala.scalajs.js.ConstructorTag.materialize[T]
@@ -19,7 +19,7 @@
1919
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:11:45 ------------------------------------------------
2020
11 | val c = js.constructorTag[ScalaObject.type] // error
2121
| ^
22-
|no implicit argument of type scala.scalajs.js.ConstructorTag[ScalaObject.type] was found for parameter tag of method constructorTag in package scala.scalajs.js.
22+
|no given instance of type scala.scalajs.js.ConstructorTag[ScalaObject.type] was found for parameter tag of method constructorTag in package scala.scalajs.js.
2323
|I found:
2424
|
2525
| scala.scalajs.js.ConstructorTag.materialize[T]

tests/neg/i10603a.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-- Error: tests/neg/i10603a.scala:2:35 ---------------------------------------------------------------------------------
22
2 | val x = implicitly[List[Boolean]] // error
33
| ^
4-
| no implicit argument of type List[Boolean] was found for parameter e of method implicitly in object Predef
4+
| no given instance of type List[Boolean] was found for parameter e of method implicitly in object Predef

tests/neg/i10901.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
|
3939
| Test.foo("abc")(/* missing */summon[C]) failed with
4040
|
41-
| no implicit argument of type C was found for parameter x$2 of method foo in object Test
41+
| no given instance of type C was found for parameter x$2 of method foo in object Test

tests/neg/i11066.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-- Error: tests/neg/i11066.scala:15:37 ---------------------------------------------------------------------------------
22
15 |val x = Greeter.greet("Who's there?") // error
33
| ^
4-
|ambiguous implicit arguments: both given instance joesPrompt in object JoesPrefs and given instance jillsPrompt in object JillsPrefs match type PreferredPrompt of parameter prompt of method greet in object Greeter
4+
|ambiguous given instances: both given instance joesPrompt in object JoesPrefs and given instance jillsPrompt in object JillsPrefs match type PreferredPrompt of parameter prompt of method greet in object Greeter

tests/neg/i11897.check

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626
-- Error: tests/neg/i11897.scala:16:18 ---------------------------------------------------------------------------------
2727
16 | assert(summon[A] == A(23)) // error
2828
| ^
29-
| no implicit argument of type A was found for parameter x of method summon in object Predef
29+
| no given instance of type A was found for parameter x of method summon in object Predef
3030
-- Error: tests/neg/i11897.scala:17:18 ---------------------------------------------------------------------------------
3131
17 | assert(summon[B] == B(false)) // error
3232
| ^
33-
| no implicit argument of type B was found for parameter x of method summon in object Predef
33+
| no given instance of type B was found for parameter x of method summon in object Predef
3434
-- Error: tests/neg/i11897.scala:18:18 ---------------------------------------------------------------------------------
3535
18 | assert(summon[C] == C("c")) // error
3636
| ^
37-
| no implicit argument of type C was found for parameter x of method summon in object Predef
37+
| no given instance of type C was found for parameter x of method summon in object Predef
3838
-- Error: tests/neg/i11897.scala:19:18 ---------------------------------------------------------------------------------
3939
19 | assert(summon[E] == E(93)) // error
4040
| ^
41-
| no implicit argument of type E was found for parameter x of method summon in object Predef
41+
| no given instance of type E was found for parameter x of method summon in object Predef
4242
-- Error: tests/neg/i11897.scala:20:18 ---------------------------------------------------------------------------------
4343
20 | assert(summon[G] == G(101)) // error
4444
| ^
45-
| no implicit argument of type G was found for parameter x of method summon in object Predef
45+
| no given instance of type G was found for parameter x of method summon in object Predef

tests/neg/i12049.check

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
-- Error: tests/neg/i12049.scala:24:20 ---------------------------------------------------------------------------------
3535
24 |val _ = summon[M[B]] // error
3636
| ^
37-
| no implicit argument of type M[B] was found for parameter x of method summon in object Predef
37+
| no given instance of type M[B] was found for parameter x of method summon in object Predef
3838
|
39-
| Note: a match type could not be fully reduced:
39+
| Note: a match type could not be fully reduced:
4040
|
41-
| trying to reduce M[B]
42-
| failed since selector B
43-
| does not match case A => Int
44-
| and cannot be shown to be disjoint from it either.
45-
| Therefore, reduction cannot advance to the remaining case
41+
| trying to reduce M[B]
42+
| failed since selector B
43+
| does not match case A => Int
44+
| and cannot be shown to be disjoint from it either.
45+
| Therefore, reduction cannot advance to the remaining case
4646
|
47-
| case B => String
47+
| case B => String
4848
-- Error: tests/neg/i12049.scala:25:26 ---------------------------------------------------------------------------------
4949
25 |val _ = summon[String =:= Last[Int *: Int *: Boolean *: String *: EmptyTuple]] // error
5050
| ^

0 commit comments

Comments
 (0)