Skip to content

Irrelevant given considered and reported in error message #23253

Open
@mrdziuban

Description

@mrdziuban

Compiler version

3.3.6 through latest nightly 3.7.2-RC1-bin-20250523-ee14905-NIGHTLY

Minimized code

trait Show[A] { def apply(a: A): String }
object Show {
  given str[S <: String]: Show[S] = s => s
}

case class Test()

summon[Show[Test]]

Output

-- [E172] Type Error: ----------------------------------------------------------
8 |summon[Show[Test]]
  |                  ^
  |No given instance of type Show[Test] was found for parameter x of method summon in object Predef.
  |I found:
  |
  |    Show.str[S]
  |
  |But given instance str in object Show does not match type Show[Test].

Expectation

Show.str should not be considered or reported as part of the implicit search for Show[Test] since Test is not a subtype of String

Metadata

Metadata

Assignees

Labels

better-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions