Skip to content

Commit

Permalink
Merge pull request #13731 from dotty-staging/hidden-implicit-msg
Browse files Browse the repository at this point in the history
Fix error message when "import given" is missing
  • Loading branch information
smarter committed Oct 13, 2021
2 parents 1ed25ce + ad5a363 commit a62acc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,8 @@ trait Implicits:
def ignoredInstanceNormalImport = arg.tpe match
case fail: SearchFailureType =>
if (fail.expectedType eq pt) || isFullyDefined(fail.expectedType, ForceDegree.none) then
inferImplicit(fail.expectedType, fail.argument, arg.span) match {
inferImplicit(fail.expectedType, fail.argument, arg.span)(
using findHiddenImplicitsCtx(ctx)) match {
case s: SearchSuccess => Some(s)
case f: SearchFailure =>
f.reason match {
Expand Down
6 changes: 6 additions & 0 deletions tests/neg/hidden.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Error: tests/neg/hidden.scala:6:13 ----------------------------------------------------------------------------------
6 | summon[Int] // error
| ^
| no implicit argument of type Int was found for parameter x of method summon in object Predef
|
| Note: given instance given_Int in object A was not considered because it was not imported with `import given`.

0 comments on commit a62acc8

Please sign in to comment.