Skip to content

Single indirection makes implicitNotFound print the argument name not its value #22348

Open
@belamenso

Description

@belamenso

Compiler version

3.6.2

Minimized code

type IntLike[T] <: Boolean = T match
  case Int => true
@annotation.implicitNotFound("Comparing ${T} to Int")
type IsIntLike[T] = IntLike[T] =:= true
type Indirection[A] = IsIntLike[A] & (true =:= true) // something after & is needed for reproduction
def f[Z](using Indirection[Z]): Unit = ()
@main def main(): Unit = f[Double]

Output

[error] -- [E172] Type Error: Main.scala:7:34 
[error] 7 |@main def main(): Unit = f[Double]
[error]   |                                  ^
[error]   |                                  Comparing A to Int
[error] one error found

Expectation

This is supposed to not compile, the problem is with the error message. The custom error message prints A which is the parameter name from Indirection instead of its value Double.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions