File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ class AnyFunctionRef {
118
118
return FD->mapTypeIntoContext (FD->getResultInterfaceType ());
119
119
if (auto *CD = dyn_cast<ConstructorDecl>(AFD)) {
120
120
if (CD->hasLifetimeDependentReturn ()) {
121
- return CD->getResultInterfaceType ();
121
+ return CD->mapTypeIntoContext (CD-> getResultInterfaceType () );
122
122
}
123
123
}
124
124
return TupleType::getEmpty (AFD->getASTContext ());
Original file line number Diff line number Diff line change @@ -1078,6 +1078,7 @@ class Verifier : public ASTWalker {
1078
1078
} else if (auto *CD = dyn_cast<ConstructorDecl>(func)) {
1079
1079
if (CD->hasLifetimeDependentReturn ()) {
1080
1080
resultType = CD->getResultInterfaceType ();
1081
+ resultType = CD->mapTypeIntoContext (resultType);
1081
1082
} else {
1082
1083
resultType = TupleType::getEmpty (Ctx);
1083
1084
}
Original file line number Diff line number Diff line change @@ -137,3 +137,27 @@ struct Wrapper : ~Escapable {
137
137
return view
138
138
}
139
139
}
140
+
141
+ public struct GenericBufferView< Element> : ~ Escapable {
142
+ public typealias Index = Int
143
+ public typealias Pointer = UnsafePointer < Element >
144
+
145
+ public let baseAddress : Pointer
146
+ public let count : Int
147
+
148
+ public init < Storage> ( unsafeBuffer: UnsafeBufferPointer < Element > ,
149
+ storage: borrowing Storage )
150
+ -> _borrow( storage) Self {
151
+ let baseAddress = unsafeBuffer. baseAddress!
152
+ self = GenericBufferView < Element > ( baseAddress: baseAddress,
153
+ count: unsafeBuffer. count)
154
+ return self
155
+ }
156
+ // unsafe private API
157
+ @_unsafeNonescapableResult
158
+ init ( baseAddress: Pointer , count: Int ) {
159
+ precondition ( count >= 0 , " Count must not be negative " )
160
+ self . baseAddress = baseAddress
161
+ self . count = count
162
+ }
163
+ }
You can’t perform that action at this time.
0 commit comments