继承 class 未看到基础 class

Inheriting class not seeing base class

我在一个文件中有一个摘要class:

namespace Dac.V5

[<AbstractClass>]
type DacRecord(recordType: int16) =
    do
        if recordType < 0s then
            invalidArg (nameof recordType) "Argument out of range"

    member this.Type = recordType

和相邻文件中的继承 class:

namespace Dac.V5

[<AbstractClass>]
type DacReturnRecord(recordType: int16, decodedData: byte seq) =
    inherit DacRecord(recordType)

    let data: byte seq = decodedData

    member this.Data with get() = data and set(v) = data <- v

然而,在继承 class 中,基础 class 出现未定义,我在 inherit 语句中得到一个错误。

这些文件位于同一个子目录中,并以它们包含的 classes 命名。

如评论中所述,您需要对文件进行排序,以便基础 class 位于继承文件之前。执行此操作后,它应该可以工作,除了您需要将 data 标记为 mutable:

[<AbstractClass>]
type DacReturnRecord(recordType: int16, decodedData: byte seq) =
    inherit DacRecord(recordType)

    let mutable data: byte seq = decodedData

    member this.Data with get() = data and set(v) = data <- v