File tree 24 files changed +61
-63
lines changed
compiler/src/dotty/tools/dotc/typer
24 files changed +61
-63
lines changed Original file line number Diff line number Diff line change @@ -306,15 +306,13 @@ class ImplicitSearchError(
306
306
307
307
private def location (preposition : String ) = if (where.isEmpty) " " else s " $preposition $where"
308
308
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" )}"
312
312
)
313
- }
314
313
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" )}"
318
316
319
317
/** Construct a custom error message given an ambiguous implicit
320
318
* candidate `alt` and a user defined message `raw`.
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg-custom-args/i13838.scala:10:5 ----------------------------------------------------------------------
2
2
10 | foo // error
3
3
| ^
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
5
5
|
6
6
|where: X is a type variable
7
7
|.
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg-macros/i6436.scala:5:9 -----------------------------------------------------------------------------
2
2
5 | case '{ StringContext(${Varargs(parts)}*) } => // error
3
3
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
- | no implicit argument of type scala.quoted.Quotes was found
4
+ | no given instance of type scala.quoted.Quotes was found
5
5
-- [E006] Not Found Error: tests/neg-macros/i6436.scala:6:34 -----------------------------------------------------------
6
6
6 | val ps: Seq[Expr[String]] = parts // error
7
7
| ^^^^^
Original file line number Diff line number Diff line change 2
2
-- Error: tests/neg-macros/i9014b/Test_2.scala:1:23 --------------------------------------------------------------------
3
3
1 |val tests = summon[Bar] // error
4
4
| ^
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:
7
7
|
8
- | given_Bar
8
+ | given_Bar
9
9
|
10
- | But given instance given_Bar does not match type Bar.
10
+ | But given instance given_Bar does not match type Bar.
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:9:39 -------------------------------------------------
2
2
9 | val a = js.constructorTag[ScalaClass] // error
3
3
| ^
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.
5
5
|I found:
6
6
|
7
7
| scala.scalajs.js.ConstructorTag.materialize[T]
10
10
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:10:39 ------------------------------------------------
11
11
10 | val b = js.constructorTag[ScalaTrait] // error
12
12
| ^
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.
14
14
|I found:
15
15
|
16
16
| scala.scalajs.js.ConstructorTag.materialize[T]
19
19
-- Error: tests/neg-scalajs/jsconstructortag-error-in-typer.scala:11:45 ------------------------------------------------
20
20
11 | val c = js.constructorTag[ScalaObject.type] // error
21
21
| ^
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.
23
23
|I found:
24
24
|
25
25
| scala.scalajs.js.ConstructorTag.materialize[T]
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i10603a.scala:2:35 ---------------------------------------------------------------------------------
2
2
2 | val x = implicitly[List[Boolean]] // error
3
3
| ^
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
Original file line number Diff line number Diff line change 38
38
|
39
39
| Test.foo("abc")(/* missing */summon[C]) failed with
40
40
|
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
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i11066.scala:15:37 ---------------------------------------------------------------------------------
2
2
15 |val x = Greeter.greet("Who's there?") // error
3
3
| ^
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
Original file line number Diff line number Diff line change 26
26
-- Error: tests/neg/i11897.scala:16:18 ---------------------------------------------------------------------------------
27
27
16 | assert(summon[A] == A(23)) // error
28
28
| ^
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
30
30
-- Error: tests/neg/i11897.scala:17:18 ---------------------------------------------------------------------------------
31
31
17 | assert(summon[B] == B(false)) // error
32
32
| ^
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
34
34
-- Error: tests/neg/i11897.scala:18:18 ---------------------------------------------------------------------------------
35
35
18 | assert(summon[C] == C("c")) // error
36
36
| ^
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
38
38
-- Error: tests/neg/i11897.scala:19:18 ---------------------------------------------------------------------------------
39
39
19 | assert(summon[E] == E(93)) // error
40
40
| ^
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
42
42
-- Error: tests/neg/i11897.scala:20:18 ---------------------------------------------------------------------------------
43
43
20 | assert(summon[G] == G(101)) // error
44
44
| ^
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
Original file line number Diff line number Diff line change 34
34
-- Error: tests/neg/i12049.scala:24:20 ---------------------------------------------------------------------------------
35
35
24 |val _ = summon[M[B]] // error
36
36
| ^
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
38
38
|
39
- | Note: a match type could not be fully reduced:
39
+ | Note: a match type could not be fully reduced:
40
40
|
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
46
46
|
47
- | case B => String
47
+ | case B => String
48
48
-- Error: tests/neg/i12049.scala:25:26 ---------------------------------------------------------------------------------
49
49
25 |val _ = summon[String =:= Last[Int *: Int *: Boolean *: String *: EmptyTuple]] // error
50
50
| ^
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i12232.scala:17:15 ---------------------------------------------------------------------------------
2
2
17 | foo(min(3, 4)) // error: works in Scala 2, not in 3
3
3
| ^
4
- | no implicit argument of type Op[Int, Int, V] was found for parameter op of method min in object Foo
4
+ | no given instance of type Op[Int, Int, V] was found for parameter op of method min in object Foo
5
5
|
6
- | where: V is a type variable with constraint <: Double
6
+ | where: V is a type variable with constraint <: Double
7
7
-- Error: tests/neg/i12232.scala:19:16 ---------------------------------------------------------------------------------
8
8
19 | foo(minR(3, 4)) // error: works in Scala 2, not in 3
9
9
| ^
10
- | no implicit argument of type Op[Int, Int, R] was found for parameter op of method minR in object Foo
10
+ | no given instance of type Op[Int, Int, R] was found for parameter op of method minR in object Foo
11
11
|
12
- | where: R is a type variable with constraint <: Double
12
+ | where: R is a type variable with constraint <: Double
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i12591/Inner.scala:12:31 ---------------------------------------------------------------------------
2
2
12 |val badSummon = summon[TC[Bar]] // error here
3
3
| ^
4
- |ambiguous implicit arguments : both outer.inner.Foo.ofFoo and outer.Foo.ofFoo match type outer.inner.Foo.TC[outer.Bar] of parameter x of method summon in object Predef
4
+ |ambiguous given instances : both outer.inner.Foo.ofFoo and outer.Foo.ofFoo match type outer.inner.Foo.TC[outer.Bar] of parameter x of method summon in object Predef
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i13991.scala:5:7 -----------------------------------------------------------------------------------
2
2
5 | first[String] // error // before line 10 to test alignment of the error message `|`
3
3
| ^^^^^^^^^^^^^
4
- | no implicit argument of type Foo[String] was found
4
+ | no given instance of type Foo[String] was found
5
5
|--------------------------------------------------------------------------------------------------------------------
6
6
|Inline stack trace
7
7
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Original file line number Diff line number Diff line change 13
13
-- Error: tests/neg/i5498-postfixOps.scala:6:0 -------------------------------------------------------------------------
14
14
6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error
15
15
|^
16
- |no implicit argument of type scala.concurrent.duration.DurationConversions.Classifier[Null] was found for parameter ev of method second in trait DurationConversions
16
+ |no given instance of type scala.concurrent.duration.DurationConversions.Classifier[Null] was found for parameter ev of method second in trait DurationConversions
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i7613.scala:10:16 ----------------------------------------------------------------------------------
2
2
10 | new BazLaws[A] {} // error // error
3
3
| ^
4
- | no implicit argument of type Baz[A] was found for parameter x$1 of constructor BazLaws in trait BazLaws
4
+ | no given instance of type Baz[A] was found for parameter x$1 of constructor BazLaws in trait BazLaws
5
5
-- Error: tests/neg/i7613.scala:10:2 -----------------------------------------------------------------------------------
6
6
10 | new BazLaws[A] {} // error // error
7
7
| ^
8
- | no implicit argument of type Bar[A] was found for parameter x$1 of constructor BarLaws in trait BarLaws
8
+ | no given instance of type Bar[A] was found for parameter x$1 of constructor BarLaws in trait BarLaws
Original file line number Diff line number Diff line change 8
8
| /* ambiguous: both object listMonad in object M and object optionMonad in object M match type M[F] */summon[M[F]]
9
9
| ) failed with
10
10
|
11
- | ambiguous implicit arguments : both object listMonad in object M and object optionMonad in object M match type M[F] of parameter m of method pure in object M
11
+ | ambiguous given instances : both object listMonad in object M and object optionMonad in object M match type M[F] of parameter m of method pure in object M
12
12
-- Error: tests/neg/i9185.scala:8:28 -----------------------------------------------------------------------------------
13
13
8 | val value3 = M.pure("ola") // error
14
14
| ^
15
- |ambiguous implicit arguments : both object listMonad in object M and object optionMonad in object M match type M[F] of parameter m of method pure in object M
15
+ |ambiguous given instances : both object listMonad in object M and object optionMonad in object M match type M[F] of parameter m of method pure in object M
16
16
-- [E008] Not Found Error: tests/neg/i9185.scala:11:16 -----------------------------------------------------------------
17
17
11 | val l = "abc".len // error
18
18
| ^^^^^^^^^
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i9568.scala:13:10 ----------------------------------------------------------------------------------
2
2
13 | blaMonad.foo(bla) // error: diverges
3
3
| ^
4
- | no implicit argument of type => Monad[F] was found for parameter ev of method blaMonad in object Test
4
+ | no given instance of type => Monad[F] was found for parameter ev of method blaMonad in object Test
5
5
|
6
6
| where: F is a type variable with constraint <: [_] =>> Any
7
7
| .
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/i9958.scala:1:30 -----------------------------------------------------------------------------------
2
2
1 |val x = summon[[X] =>> (X, X)] // error
3
3
| ^
4
- | no implicit argument of type [X] =>> (X, X) was found for parameter x of method summon in object Predef
4
+ | no given instance of type [X] =>> (X, X) was found for parameter x of method summon in object Predef
5
5
-- [E007] Type Mismatch Error: tests/neg/i9958.scala:8:10 --------------------------------------------------------------
6
6
8 |def b = f(a) // error
7
7
| ^
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/implicitSearch.scala:13:12 -------------------------------------------------------------------------
2
2
13 | sort(xs) // error (with a partially constructed implicit argument shown)
3
3
| ^
4
- | no implicit argument of type Test.Ord[List[List[T]]] was found for parameter o of method sort in object Test.
5
- | I found:
4
+ | no given instance of type Test.Ord[List[List[T]]] was found for parameter o of method sort in object Test.
5
+ | I found:
6
6
|
7
- | Test.listOrd[List[T]](Test.listOrd[T](/* missing */summon[Test.Ord[T]]))
7
+ | Test.listOrd[List[T]](Test.listOrd[T](/* missing */summon[Test.Ord[T]]))
8
8
|
9
- | But no implicit values were found that match type Test.Ord[T].
9
+ | But no implicit values were found that match type Test.Ord[T].
10
10
-- Error: tests/neg/implicitSearch.scala:15:38 -------------------------------------------------------------------------
11
11
15 | listOrd(listOrd(implicitly[Ord[T]] /*not found*/)) // error
12
12
| ^
13
- | no implicit argument of type Test.Ord[T] was found for parameter e of method implicitly in object Predef
13
+ | no given instance of type Test.Ord[T] was found for parameter e of method implicitly in object Predef
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/missing-implicit1.scala:17:4 -----------------------------------------------------------------------
2
2
17 | ff // error
3
3
| ^
4
- |no implicit argument of type testObjectInstance.Zip[Option] was found for parameter xs of method ff in object testObjectInstance
4
+ |no given instance of type testObjectInstance.Zip[Option] was found for parameter xs of method ff in object testObjectInstance
5
5
|
6
6
|The following import might fix the problem:
7
7
|
19
19
-- Error: tests/neg/missing-implicit1.scala:23:42 ----------------------------------------------------------------------
20
20
23 | List(1, 2, 3).traverse(x => Option(x)) // error
21
21
| ^
22
- |no implicit argument of type testObjectInstance.Zip[Option] was found for an implicit parameter of method traverse in trait Traverse
22
+ |no given instance of type testObjectInstance.Zip[Option] was found for an implicit parameter of method traverse in trait Traverse
23
23
|
24
24
|The following import might fix the problem:
25
25
|
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/missing-implicit2.scala:10:18 ----------------------------------------------------------------------
2
2
10 | f(using xFromY) // error
3
3
| ^
4
- | no implicit argument of type Y was found for parameter y of given instance xFromY
4
+ | no given instance of type Y was found for parameter y of given instance xFromY
5
5
|
6
6
| The following import might fix the problem:
7
7
|
10
10
-- Error: tests/neg/missing-implicit2.scala:16:5 -----------------------------------------------------------------------
11
11
16 | f // error
12
12
| ^
13
- | no implicit argument of type X was found for parameter x of method f in object test
13
+ | no given instance of type X was found for parameter x of method f in object test
14
14
|
15
15
| The following import might make progress towards fixing the problem:
16
16
|
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg/missing-implicit3.scala:13:36 ----------------------------------------------------------------------
2
2
13 |val sortedFoos = sort(List(new Foo)) // error
3
3
| ^
4
- |no implicit argument of type ord.Ord[ord.Foo] was found for an implicit parameter of method sort in package ord.
5
- |I found:
4
+ | no given instance of type ord.Ord[ord.Foo] was found for an implicit parameter of method sort in package ord.
5
+ | I found:
6
6
|
7
- | ord.Ord.ordered[ord.Foo](/* missing */summon[ord.Foo => Comparable[? >: ord.Foo]])
7
+ | ord.Ord.ordered[ord.Foo](/* missing */summon[ord.Foo => Comparable[? >: ord.Foo]])
8
8
|
9
- |But no implicit values were found that match type ord.Foo => Comparable[? >: ord.Foo].
9
+ | But no implicit values were found that match type ord.Foo => Comparable[? >: ord.Foo].
You can’t perform that action at this time.
0 commit comments