Skip to content
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

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

Open
belamenso opened this issue Jan 12, 2025 · 0 comments

Comments

@belamenso
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants