【发布时间】:2011-01-16 08:52:58
【问题描述】:
我知道我必须在这里遗漏一些非常明显的东西。 B.GetInstance().Call() 生成错误:根据此程序点之前的信息查找不确定类型的对象。在这个程序点之前可能需要一个类型注释来约束对象的类型。这可能会解决查找问题。
我正在使用 v1.9.9.9。
type A() =
member x.Call() = B.GetInstance().Call()
and B() =
static member GetInstance() = new B()
member x.Call() = ()
我刚刚发现这行得通:(B.GetInstance() :> B).Call()
知道为什么需要演员表吗?
【问题讨论】:
标签: f# type-inference