Skip to content

[SR-7422] Protocol extension with a same type non-final class constraint cannot be conformed to by said class #49965

@hamishknight

Description

@hamishknight
Previous ID SR-7422
Radar None
Original Reporter @hamishknight
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 4.2-dev (LLVM 064f71a292, Clang 238f385323, Swift 18b28b9)
Target: x86_64-apple-darwin17.5.0

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

md5: 6015a5fb7960efaf9e0cda5af8f7a9e8

Issue Description:

The following compiles in 4.0.3, but doesn't in 4.1:

class C {}

protocol P {
  func foo()
}

extension P where Self == C {
  func foo() {}
}

extension C : P {} // Type 'C' does not conform to protocol 'P'

I believe this is because of #12174 which changed the witness thunk for foo() from (C) -> Void to <Self : C>(Self) -> Void, thus making it not match the extension implementation signature of (C) -> Void.

I'm unsure if this regression is intentional or not (given we have no covariant Self returns in play here), filing here for confirmation.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions