我正尝试加入Dictionary<int, string>和List<MyClass>但它抛出一个错误 “的方法类型参数不能从使用中推断“。 但在我看来,所有的参数都完全被定义... class Row
{
public string name { get; set; }
public string[] data { get; set; }
}
Dictionary
试图在新元素给定点更换列表中的一个元素,然后返回元素。 setelt :: Int -> [a] -> a -> [a]
setelt x (yf:(y:yl)) z
| x == (length yf) = (yf:(z:yl))
导致此错误: Inferred type is not general enough
Expression : setelt
Expected t
我在寻找一个类似的推断拍摄的泛型类型,类似于下面的方法片段的概念,但不是为捕获泛型类: public <X, Y, Z> static void someMethod(ObjectInterface<X, Y, Z> object) {
// code that uses inferred generic type parameters X, Y and Z...
}
的代码在这个
为什么在编译此代码段时出现错误? trait ID[R <: Record[R] with KeyedRecord[Long]] {
this: R =>
val idField = new LongField(this)
}
错误: inferred type arguments [ID[R] with R] do not conform to class Long