You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
Target: x86_64-apple-darwin17.7.0
Additional Detail from JIRA
Votes
1
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 5a27fa3f9bb439cc95c51743b123a931
is duplicated by:
SR-9582 Change "can derive conformances" condition for CaseIterable
relates to:
SR-9582 Change "can derive conformances" condition for CaseIterable
SR-8776 Confusing error with broken CaseIterable conformance
Issue Description:
If I declare conformance to CaseIterable but also manually declare a typealias for AllCases, the compiler should still synthesize conformance as long as the AllCases type conforms to both Collection and ExpressibleByArrayLiteral. Right now attempting to do this produces a protocol 'CaseIterable' is broken error that AIUI is supposed to mean the compiler thinks the standard library's definition of CaseIterable is wrong.
The use-case here is writing something like
publicenumFoo: CaseIterable {
publictypealiasAllCases = Set<Foo>
caseone, two, three
}
I posted this on the forums and brentdax (JIRA User) suggested that this could be considered a bug fix.
The text was updated successfully, but these errors were encountered:
This is exposing a more general problem with interactions with the derivation machinery and user-provided declarations
enumFoo: Int {
typealiasRawValue = UIntcaseone = 1, two = 2, three = 3
}
{{error: repl.swift:1:11: error: 'Foo' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized
enum Foo: Int {
^
error: repl.swift:1:6: error: protocol 'RawRepresentable' is broken; cannot derive conformance for type 'Foo'
enum Foo: Int {
^
error: repl.swift:1:6: error: protocol 'RawRepresentable' is broken; cannot derive conformance for type 'Foo'
enum Foo: Int {
^
}}
Environment
Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
Target: x86_64-apple-darwin17.7.0
Additional Detail from JIRA
md5: 5a27fa3f9bb439cc95c51743b123a931
is duplicated by:
CaseIterable
relates to:
CaseIterable
Issue Description:
If I declare conformance to
CaseIterable
but also manually declare atypealias
forAllCases
, the compiler should still synthesize conformance as long as theAllCases
type conforms to bothCollection
andExpressibleByArrayLiteral
. Right now attempting to do this produces aprotocol 'CaseIterable' is broken
error that AIUI is supposed to mean the compiler thinks the standard library's definition ofCaseIterable
is wrong.The use-case here is writing something like
I posted this on the forums and brentdax (JIRA User) suggested that this could be considered a bug fix.
The text was updated successfully, but these errors were encountered: