IDE: Fire
Version: Version 10.0.0.2398 (develop) built on talax, 20190426-081224. Commit f04dec1.
Target (If relevant): iOS/macOS
Description:
Fail to compile Swift code that works fine in Xcode 10.2
Expected Behavior:
Code to compile successfully
Actual Behavior:
Getting the following compiler errors:
E: Associated type "Value" from protocol "CellType<Value>" was not set [/Users/x/Desktop/Bug/BugReport3/ConsoleApplication3/Program.swift (58)]
E: Unknown type "Cell.Value" [/Users/x/Desktop/Bug/BugReport3/ConsoleApplication3/Program.swift (54)]
-> Phase Resolving Bodies started.
E: Unknown type "Cell.Type", did you mean "CellType"? [/Users/x/Desktop/Bug/BugReport3/ConsoleApplication3/Program.swift (55)]
E: Generic parameter doesn't fulfill constraint "CellType<Value>" for "Cell" [/Users/x/Desktop/Bug/BugReport3/ConsoleApplication3/Program.swift (65)]
E: Generic parameter doesn't fulfill constraint "Equatable" for "Value" [/Users/x/Desktop/Bug/BugReport3/ConsoleApplication3/Program.swift (55)]
Steps:
- Create a new console application
- Use the code
import Foundation
open class BaseCell: NSObject {
}
/// Generic class that represents the Eureka cells.
open class Cell<T>: BaseCell {
public typealias Value = T
}
open class BaseRow: NSObject {
/// String that uniquely identifies a row. Must be unique among rows and sections.
public var tag: String?
public required init(tag: String? = nil) {
self.tag = tag
}
}
open class RowOf<T>: BaseRow {
private var _value: T?
open var value: T? {
set (newValue) {
_value = newValue
}
get {
return _value
}
}
public required init(tag: String?) {
super.init(tag: tag)
}
}
public protocol CellType: class {
associatedtype Value: Equatable
}
open class LabelValueObject: Equatable {
public static func == (lhs: LabelValueObject, rhs: LabelValueObject) -> Bool {
return true
}
}
open class Row<Cell: CellType>: RowOf<Cell.Value> where Cell: BaseCell {
public let cellType: Cell.Type! = Cell.self
}
open class LabelCellOf<T: Equatable>: Cell<T>, CellType {
}
public typealias LabelCell = LabelCellOf<LabelValueObject>
// MARK: LabelRow
open class _LabelRow: Row<LabelCell> {
required public init(tag: String?) {
super.init(tag: tag)
}
}
print("The magic happens here.")