Skip to content

Fix error message when "import given" is missing #13731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.