Skip to content

Commit a62acc8

Browse files
authored
Merge pull request #13731 from dotty-staging/hidden-implicit-msg
Fix error message when "import given" is missing
2 parents 1ed25ce + ad5a363 commit a62acc8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,8 @@ trait Implicits:
876876
def ignoredInstanceNormalImport = arg.tpe match
877877
case fail: SearchFailureType =>
878878
if (fail.expectedType eq pt) || isFullyDefined(fail.expectedType, ForceDegree.none) then
879-
inferImplicit(fail.expectedType, fail.argument, arg.span) match {
879+
inferImplicit(fail.expectedType, fail.argument, arg.span)(
880+
using findHiddenImplicitsCtx(ctx)) match {
880881
case s: SearchSuccess => Some(s)
881882
case f: SearchFailure =>
882883
f.reason match {

tests/neg/hidden.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Error: tests/neg/hidden.scala:6:13 ----------------------------------------------------------------------------------
2+
6 | summon[Int] // error
3+
| ^
4+
| no implicit argument of type Int was found for parameter x of method summon in object Predef
5+
|
6+
| Note: given instance given_Int in object A was not considered because it was not imported with `import given`.

0 commit comments

Comments
 (0)