Skip to content

[SR-15150] Async overloading in protocol implementation fails #57476

@swift-ci

Description

@swift-ci
Previous ID SR-15150
Radar rdar://FB9595388
Original Reporter Nekitosss (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.29.102 clang-1300.0.28.1)

Target: x86_64-apple-macosx12.0

MacOS: 12.0 Beta (21A5506j)

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

md5: 8395967ad9ff21d97cd2235d2936f952

Issue Description:

Amendment swiftlang/swift-evolution#1392 is incomplete.

Compilation fails, when class with both async and async method versions trying to satisfy protocol requirement with both sync and async methods or just async method implementation.

protocol TestProtocol {
    func read() // Compilation also fails if TestProtocol contains only async version
    func read() async
}

// Note: everything compiles and resolves correctly in call side when TestClass does not implement TestProtocol 
class TestClass: TestProtocol {
    func read() {}
    func read() async {}
}

Throws several issues:

  • error: type 'TestClass' does not conform to protocol 'TestProtocol'

  • note: multiple matching functions named 'read()' with type '() async -> ()'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions