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 {
118118 return FD->mapTypeIntoContext (FD->getResultInterfaceType ());
119119 if (auto *CD = dyn_cast<ConstructorDecl>(AFD)) {
120120 if (CD->hasLifetimeDependentReturn ()) {
121- return CD->getResultInterfaceType ();
121+ return CD->mapTypeIntoContext (CD-> getResultInterfaceType () );
122122 }
123123 }
124124 return TupleType::getEmpty (AFD->getASTContext ());
Original file line number Diff line number Diff line change @@ -1078,6 +1078,7 @@ class Verifier : public ASTWalker {
10781078 } else if (auto *CD = dyn_cast<ConstructorDecl>(func)) {
10791079 if (CD->hasLifetimeDependentReturn ()) {
10801080 resultType = CD->getResultInterfaceType ();
1081+ resultType = CD->mapTypeIntoContext (resultType);
10811082 } else {
10821083 resultType = TupleType::getEmpty (Ctx);
10831084 }
Original file line number Diff line number Diff line change @@ -137,3 +137,27 @@ struct Wrapper : ~Escapable {
137137 return view
138138 }
139139}
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