mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
35 lines
1.4 KiB
Swift
35 lines
1.4 KiB
Swift
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -primary-file %s -emit-ir > %t.ll
|
|
// RUN: %FileCheck %s < %t.ll
|
|
|
|
|
|
// SR-6200: canonicalizing a conformance access path that was built
|
|
// without the requirement signature.
|
|
public struct Valid<V> {}
|
|
|
|
extension Valid where V: ValidationSuite {}
|
|
|
|
public protocol Validatable {}
|
|
|
|
extension Validatable {
|
|
public func tested() {}
|
|
|
|
// CHECK-LABEL: define{{.*}}_T023conformance_access_path11ValidatablePAAE6tested2byyqd__m_t9InputTypeQyd__RszAA15ValidationSuiteRd__lF
|
|
public func tested<S: ValidationSuite>(by suite: S.Type) where S.InputType == Self {
|
|
// CHECK: [[S_AS_VALIDATION_SUITE:%[0-9]+]] = load i8*, i8** %S.ValidationSuite
|
|
// CHECK-NEXT: [[S_VALIDATOR_BASE:%.*]] = bitcast i8* [[S_AS_VALIDATION_SUITE]] to i8**
|
|
// CHECK-NEXT: [[S_VALIDATABLE_ADDR:%[0-9]+]] = getelementptr inbounds i8*, i8** [[S_VALIDATOR_BASE]], i32 1
|
|
// CHECK-NEXT: [[S_VALIDATABLE_FN_RAW:%[0-9]+]] = load i8*, i8** [[S_VALIDATABLE_ADDR]]
|
|
// CHECK-NEXT: [[S_VALIDATABLE_FN:%[0-9]+]] = bitcast i8* [[S_VALIDATABLE_FN_RAW]] to i8** (%swift.type*, %swift.type*, i8**)*
|
|
// CHECK-NEXT: call i8** [[S_VALIDATABLE_FN]](%swift.type* %Self, %swift.type* %S, i8** %S.Validator)
|
|
tested()
|
|
}
|
|
}
|
|
|
|
public protocol Validator {
|
|
associatedtype InputType: Validatable
|
|
}
|
|
|
|
public protocol ValidationSuite: Validator {
|
|
associatedtype InputType: Validatable
|
|
}
|