mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
A new implementation from "first principles". The idea is that for a given conformance, we either have an explicit source which forms the root of the requirement path, or a derived source, which we 'factor' into a parent type/parent protocol pair, and a requirement signature requirement. We recursively compute the conformance access path of the parent type and parent protocol, and append the path element for the requirement. This fixes a long-standing crasher, and eliminates two hacks, the 'usesRequirementSource' flag in RequirementSource, and the 'HadAnyRedundantConstraints' flag in GenericSignatureBuilder. Fixes https://bugs.swift.org/browse/SR-7371 / rdar://problem/39239511
37 lines
1.0 KiB
Swift
37 lines
1.0 KiB
Swift
// RUN: %target-swift-frontend -emit-ir %s
|
|
|
|
public protocol TypedParserResultTransferType {
|
|
// Remove type constraint
|
|
associatedtype Result: ParserResult
|
|
}
|
|
|
|
public struct AnyTypedParserResultTransferType<P: ParserResult>: TypedParserResultTransferType {
|
|
public typealias Result = P
|
|
// Remove property
|
|
public let result: P
|
|
}
|
|
|
|
public protocol ParserResult {}
|
|
public protocol StaticParser: ParserResult {}
|
|
|
|
// Change comformance to ParserResult
|
|
public protocol TypedStaticParser: StaticParser {
|
|
// Remove type constraint
|
|
associatedtype ResultTransferType: TypedParserResultTransferType
|
|
}
|
|
|
|
// Remove where clause
|
|
public protocol MutableSelfStaticParser: TypedStaticParser where ResultTransferType == AnyTypedParserResultTransferType<Self> {
|
|
func parseTypeVar() -> AnyTypedParserResultTransferType<Self>
|
|
}
|
|
|
|
extension MutableSelfStaticParser {
|
|
|
|
public func anyFunction() -> () {
|
|
let t = self.parseTypeVar
|
|
// Remove this and below
|
|
_ = t()
|
|
_ = self.parseTypeVar()
|
|
}
|
|
}
|