File tree Expand file tree Collapse file tree 4 files changed +95
-1
lines changed
branches/swift-5.1-branch-08-28-2019 Expand file tree Collapse file tree 4 files changed +95
-1
lines changed Original file line number Diff line number Diff line change @@ -1508,4 +1508,4 @@ refs/heads/revert-27301-syntaxparse-associatedtype: 859f90afc1557bf5600de108927b
1508
1508
refs/heads/shahmishal/pr-test-swift: 868c7a884713b910757f2f3d4c413e395aeba76c
1509
1509
refs/heads/shahmishal/pr-test-swift-2: fa33242bb6401b5206e2e3ce50624febfc469625
1510
1510
refs/heads/swift-5.1-branch-07-24-2019: 0450b7d81e75701c325138e6af52d470bb3dafdd
1511
- refs/heads/swift-5.1-branch-08-28-2019: 2ec5035cc5386f11e2872212dc24c3897e61912e
1511
+ refs/heads/swift-5.1-branch-08-28-2019: 921f508d3e4b27e2d038ed4eaf6c904fd864accc
Original file line number Diff line number Diff line change @@ -735,7 +735,9 @@ void ASTMangler::appendOpaqueDeclName(const OpaqueTypeDecl *opaqueDecl) {
735
735
if (canSymbolicReference (opaqueDecl)) {
736
736
appendSymbolicReference (opaqueDecl);
737
737
} else if (auto namingDecl = opaqueDecl->getNamingDecl ()) {
738
+ CanGenericSignature savedSignature = CurGenericSignature;
738
739
appendEntity (namingDecl);
740
+ CurGenericSignature = savedSignature;
739
741
appendOperator (" QO" );
740
742
} else {
741
743
llvm_unreachable (" todo: independent opaque type decls" );
Original file line number Diff line number Diff line change
1
+ public protocol Proto {
2
+ associatedtype Assoc : Proto
3
+ var value : Assoc { get }
4
+ }
5
+
6
+ extension Never : Proto { }
7
+
8
+ extension Never {
9
+ public typealias Assoc = Never
10
+
11
+ public var value : Never {
12
+ switch self { }
13
+ }
14
+ }
15
+ protocol PrimitiveProto : Proto { }
16
+
17
+ extension PrimitiveProto {
18
+ public var value : Never { valueError ( ) }
19
+ }
20
+
21
+ extension Proto {
22
+ func valueError( ) -> Never {
23
+ fatalError ( " value() should not be called on \( Self . self) . " )
24
+ }
25
+ }
26
+
27
+ public struct EmptyProto : PrimitiveProto {
28
+ public init ( ) { }
29
+ }
30
+
31
+ struct M < Content: Proto > : Proto {
32
+ var t : Content
33
+
34
+ init ( _ t: Content ) {
35
+ self . t = t
36
+ }
37
+
38
+ var value : some Proto {
39
+ return t. value
40
+ }
41
+ }
42
+
43
+ public struct Group < T> {
44
+ var t : T
45
+
46
+ public init ( _ t: T ) {
47
+ self . t = t
48
+ }
49
+ }
50
+
51
+ extension Group : Proto , PrimitiveProto where T : Proto {
52
+ public typealias Assoc = Never
53
+ }
54
+
55
+ public struct Choice < T, V> {
56
+ var v : V
57
+
58
+ public init ( _ t: T , _ v: V ) {
59
+ self . v = v
60
+ }
61
+ }
62
+
63
+ extension Choice : Proto where T: Proto , V: Proto {
64
+ public var value : some Proto {
65
+ return v. value
66
+ }
67
+ }
68
+
69
+ extension Proto {
70
+ public func add( ) -> some Proto {
71
+ return M ( self )
72
+ }
73
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend -disable-availability-checking -emit-module -enable-library-evolution -emit-module-path=%t/A.swiftmodule -module-name=A %S/Inputs/mangle-opaque-return-types-A.swift
3
+ // RUN: %target-swift-frontend -disable-availability-checking -I %t -emit-ir %s
4
+ import A
5
+
6
+ public struct C < T, Content: Proto > {
7
+ let data : T
8
+ let content : Content
9
+
10
+ init ( _ t: T , _ c: Content ) {
11
+ data = t
12
+ content = c
13
+ }
14
+
15
+ public var dontCrash : some Proto {
16
+ return Group ( Choice ( content, EmptyProto ( ) . add ( ) ) )
17
+ }
18
+ }
19
+
You can’t perform that action at this time.
0 commit comments