Skip to content

[SR-6526] Can't conform a type declared inside a function to Equatable #49076

@hartbit

Description

@hartbit
Previous ID SR-6526
Radar None
Original Reporter @hartbit
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 9.1 (9B55)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: fb096e9bc4169fc9bbcf35e80ff44420

duplicates:

  • SR-3092 Function-level nested types cannot conform to Equatable

Issue Description:

func foo() {
    struct Inner: Equatable { // error: Type 'Inner' does not conform to protocol 'Equatable'
        let prop: Int

        static func ==(lhs: Inner, rhs: Inner) -> Bool {
            return lhs.prop == rhs.prop
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesnested typesFeature: nested typesoperatorsFeature: operatorsswift 4.0type checkerArea → compiler: Semantic analysisunexpected errorBug: Unexpected error

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions