'Equatable'无法在扩展中自动合成

'Equatable' cannot be automatically synthesized in an extension

这个有效:

// Conformance to protocol correctly synthesized by compiler 
struct MyStruct: Equatable { 
}

这不是:

struct MyStruct { 
}
// Doesn't work, even though the extension is in the same file
extension MyStruct: Equatable {
}

错误很明显:

implementation of 'Equatable' cannot be automatically synthesized in an extension

我担心的是,根据 Swift 的提议 SE-0185,这应该是允许的:

SE-0185: Synthesizing Equatable and Hashable conformance

Users must opt-in to automatic synthesis by declaring their type as Equatable or Hashable without implementing any of their requirements. This conformance must be part of the original type declaration or in an extension in the same file (to ensure that private and fileprivate members can be accessed from the extension).

它说这是在 Swift 4.1 (apple/swift#9619) 中实现的。

但是,在尝试编译时,出现了之前显示的错误。我正在使用 Ubuntu 16.04,这两个版本的 swift 都失败了 我有:

我是不是漏掉了什么?

好消息

最近的开发者。 2018 年 6 月 5 日的快照按预期工作:


坏消息

最新的 -release- 版本 4.1.2 不工作。