Until the language supports this directly you can express it with kind-projector, which is a pretty standard plugin in the FP community. Highly recommended.
@ def foo[A, B: ? =:= A] = 42
defined function foo
@ foo[Int, String]
cmd1.sc:1: Cannot prove that String =:= Int.
val res1 = foo[Int,String]
^
Compilation Failed
@ foo[Int,Int]
res1: Int = 42