【发布时间】:2014-11-08 07:30:17
【问题描述】:
我有以下设置:
class Test[A](function: A => String) {
def process(data: Any) { //has to be Any since it is user IO
if (data of Type A)
function(data)
}
}
我似乎无法让类型检查工作。 我尝试将隐式 TypeTag 添加到 Test[A] 但我无法从进程中访问它。 是否可以在过程函数中匹配Test的类型参数?
【问题讨论】:
标签: scala type-parameter erasure