Last active
August 29, 2015 14:13
-
-
Save indragiek/9c4bdaff950515e0a95b to your computer and use it in GitHub Desktop.
This code doesn't compile (Xcode 6.1.1, Swift 1.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol TableViewSectionType { | |
typealias ItemCollection: CollectionType | |
} | |
public protocol TableViewCellFactoryType { | |
typealias Item | |
} | |
public final class TableViewDataSource< | |
SectionCollection: CollectionType, | |
Factory: TableViewCellFactoryType | |
where | |
SectionCollection.Generator.Element: TableViewSectionType, | |
SectionCollection.Generator.Element.ItemCollection.Generator.Element == Factory.Item // Changing this to a concrete type like Int fixes it | |
> { | |
} |
Swapping the order of SectionCollection
and Factory
in the generic type parameter list seems to have fixed it. Probably a bug, then.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code doesn't compile under Swift 1.1:
If I change this constraint:
SectionCollection.Generator.Element.ItemCollection.Generator.Element == Factory.Item
to use a concrete type like
Int
rather thanFactory.Item
, the code compiles successfully.Compiler bug or am I doing something wrong?