2
我得到的ToBar
为什么这个代码不够通用甚至更好为什么甚至检查?
type Foo = {foo: string}
type Bar = {bar: string}
[<AbstractClass>]
type AbstractType< ^T> (fn: ^T -> Foo) =
member inline this.ToFoo (x: ^T) = fn x
abstract ToBar: string -> Bar
这定义的错误是错误消息
This code is not sufficiently generic.
The type variable ^T could not be generalized
because it would escape its scope.
从事实
除了那个(甚至是阅读所有其他等等这个问题之后)我不知道得到什么这个错误试图告诉我...但它是完全惊人的ToBar
甚至不使用该类型的参数正在出现错误