swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

[SR-8961] @_implements still not quite powerful enough #51466

Open stephentyrone opened 6 years ago

stephentyrone commented 6 years ago
Previous ID SR-8961
Radar rdar://problem/45183426
Original Reporter @stephentyrone
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 2c1b9edcfc10c07c2c2e04e9ff873870

Issue Description:

I finally got to dig into experimenting with @_implements this week. It looks like it's still not quite doing what we need it to do to support the comparable changes that we'd like to make.

I refined the attr_implements_fp.swift test case to exercise the behavior that we want to achieve. The key distinction is that we need the switchover from one behavior to the other to occur at an intermediate protocol, rather than only on the base concrete types.

i.e., we want to get one behavior when constrained to Comparable, and the other when constrained to some intermediate protocol, as well as the concrete types. With the current implementation, it only seems possible to have divergent behavior on the concrete types themselves.

It may be that I'm simply missing a cleverer way to achieve this; feel free to tell me so.

Revised test case on branch here: https://github.com/stephentyrone/swift/tree/implements

stephentyrone commented 6 years ago

CC graydon (JIRA User) @jckarter

airspeedswift commented 6 years ago

@swift-ci create