1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
// REQUIRES: OS=macosx
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/includes)
// RUN: echo "[myProto]" > %t/protocols.json
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx10.15 -typecheck -emit-const-values-path %t/ExtractOpaqueGenericTypealias.swiftconstvalues -const-gather-protocols-file %t/protocols.json -primary-file %s -I %t/includes
// RUN: cat %t/ExtractOpaqueGenericTypealias.swiftconstvalues 2>&1 | %FileCheck %s
protocol myProto {
associatedtype T
func foo() -> T
}
protocol protoA<T> {
associatedtype T
}
struct A<K> : protoA {
typealias T = K
}
struct Foo<L : Hashable> : myProto {
func foo() -> some protoA<Int> { return A() }
func bar(_ param : L) {}
}
// CHECK: [
// CHECK-NEXT: {
// CHECK-NEXT: "typeName": "ExtractOpaqueGenericTypealias.Foo<L>",
// CHECK-NEXT: "mangledTypeName": "29ExtractOpaqueGenericTypealias3FooVyxG",
// CHECK-NEXT: "kind": "generic struct",
// CHECK-NEXT: "file": "{{.*}}test{{/|\\\\}}ConstExtraction{{/|\\\\}}ExtractOpaqueGenericTypealias.swift",
// CHECK-NEXT: "line": 22,
// CHECK-NEXT: "conformances": [
// CHECK-NEXT: "ExtractOpaqueGenericTypealias.myProto",
// CHECK-NEXT: "Swift.Sendable",
// CHECK-NEXT: "Swift.BitwiseCopyable"
// CHECK-NEXT: ],
// CHECK-NEXT: "associatedTypeAliases": [
// CHECK-NEXT: {
// CHECK-NEXT: "typeAliasName": "T",
// CHECK-NEXT: "substitutedTypeName": "some ExtractOpaqueGenericTypealias.protoA<Swift.Int>",
// CHECK-NEXT: "substitutedMangledTypeName": "29ExtractOpaqueGenericTypealias3FooV3fooQryFQOyx_Qo_",
// CHECK-NEXT: "opaqueTypeProtocolRequirements": [
// CHECK-NEXT: "ExtractOpaqueGenericTypealias.protoA"
// CHECK-NEXT: ],
// CHECK-NEXT: "opaqueTypeSameTypeRequirements": [
// CHECK-NEXT: {
// CHECK-NEXT: "typeAliasName": "ExtractOpaqueGenericTypealias.protoA.T",
// CHECK-NEXT: "substitutedTypeName": "Swift.Int",
// CHECK-NEXT: "substitutedMangledTypeName": "Si"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ],
// CHECK-NEXT: "properties": []
// CHECK-NEXT: }
// CHECK-NEXT: ]
|