我对枚举有以下定义:
object GraphType extends Enumeration {
type Type = Value
val MESSAGE, REQUEST, ERRORS = Value
}
现在我正在尝试将每种类型映射到相应的新类型,TimeSeries
如下所示:
val dataSets = ( GraphType.values map (graphType => graphType -> new TimeSeries(graphType)) ).toMap
类型系统列出了数据集,Map[GraphType.Value, TimeSeries]
这正是我想要的。但是,编译失败并显示错误消息:
error: diverging implicit expansion for type scala.collection.generic.CanBuildFrom[ird.replay.gui.GraphType.ValueSet,(ird.replay.gui.GraphType.Value, org.jfree.data.time.TimeSeries),That]
starting with method newCanBuildFrom in object SortedSet
val dataSets = GraphType.values map (graphType => graphType -> new TimeSeries(graphType)) toMap
任何人都可以为这个相当神秘的错误信息提供一些解释吗?谢谢