-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
compilerThe Swift compiler itselfThe Swift compiler itselffeatureA feature request or implementationA feature request or implementationswift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposal
Description
Previous ID | SR-11013 |
Radar | None |
Original Reporter | @johnno1962 |
Type | New Feature |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | New Feature, LanguageFeatureRequest |
Assignee | @johnno1962 |
Priority | Medium |
md5: adaaec1870f21fa760ae6d8b2888a02b
Issue Description:
Protocol extensions are very powerful but it is not possible to specify a protocol the extension has made all nationals conforming to the protocol being extended conform to. In short I would have thought it would be useful to be able to do the following (for example):
extension FixedWidthInteger: ExpressibleByUnicodeScalarLiteral {
public init(unicodeScalarLiteral value: Unicode.Scalar) {
self = Self(value.value)
}
}
The compiler is most of the way there already implementing the adding of members to a protocol available to all nominals conforming to the protocol. The only missing thing is being able to specify the conformance.
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselffeatureA feature request or implementationA feature request or implementationswift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposal