Is casting a function [X, Y] X => Y to X => () safe as long as I ignore the returned value?

后端 未结 0 1461
误落风尘
误落风尘 2020-12-22 02:23
val f = { x :Int => x }
val g = f.asInstanceOf[Int, Unit] 
g(1) //works

How brittle is the above code? It works currently, but of course it is no

相关标签:
回答
  • 消灭零回复
提交回复
热议问题