-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed as duplicate of#45682
Copy link
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesnested typesFeature: nested typesFeature: nested typesoperatorsFeature: operatorsFeature: operatorsswift 5.4type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Previous ID | SR-14795 |
Radar | None |
Original Reporter | robdashnash (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Duplicate |
Environment
Xcode 12.5 (12E262)
Swift 5.4
MacOS 11.4
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: a83094320601a7e3537a07f9a2558473
relates to:
- SR-3092 Function-level nested types cannot conform to Equatable
Issue Description:
Attempts to conform to comparable fail, when the class declaration is nested within a test.
func testA() throws {
final class Property: Comparable {
let id: UUID
let address: String
let date: Date
static func < (lhs: Property, rhs: Property) -> Bool {
lhs.date > rhs.date
}
static func == (lhs: Property, rhs: Property) -> Bool {
lhs.id == rhs.id
}
}
// test stuff here
}
Type 'Property' does not conform to protocol 'Equatable'.
Type 'Property' does not conform to protocol 'Comparable'.
If I cut and paste the property class code to a global scope, it works fine.
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesnested typesFeature: nested typesFeature: nested typesoperatorsFeature: operatorsFeature: operatorsswift 5.4type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error