Skip to content

Unclear/confusing "no given instance" message wording re context function type #17122

Closed
@dsbos

Description

@dsbos

A tiny, single-word bit of non-clarity in error messages:

Compiler version

3.2.2

Minimized example

object UnclearError extends App {

  case class SomeContextThing()
  case class SomeResult()

  type ContextFunctionType = SomeContextThing ?=> SomeResult

  def m(): ContextFunctionType = ???

  m()
}

Output

<...>/src/main/scala/UnclearError.scala:11:6
No given instance of type UnclearError.SomeContextThing was found for parameter of UnclearError.ContextFunctionType
The required type is an alias of: (UnclearError.SomeContextThing) ?=> UnclearError.SomeResult
  m()

Note how that says "parameter of UnclearError.ContextFunctionType" instead of clearly/correctly saying "parameter of type UnclearError.ContextFunctionType".

(Note now the phrase "required type" there can seem to refer to "type UnclearError.SomeContextThing," since that's the only other occurrence of the word "type" in the error message. That is, it can seem like it's saying that "type UnclearError.SomeContextThing" "is an alias of: (UnclearError.SomeContextThing) ?=> UnclearError.SomeResult".)

Expectation

That the "parameter of " part of that message would be worded clearly as "parameter of type " (and hopefully other, similar reference to types would do the same).

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etc

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions