File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ void GenericCloner::populateCloned() {
72
72
SmallVector<SILValue, 4 > entryArgs;
73
73
entryArgs.reserve (OrigEntryBB->getArguments ().size ());
74
74
for (auto &OrigArg : OrigEntryBB->getArguments ()) {
75
- RegularLocation Loc ((Decl *)OrigArg->getDecl ());
75
+ RegularLocation Loc = OrigArg->getDecl () ?
76
+ RegularLocation ((Decl *)OrigArg->getDecl ()) :
77
+ RegularLocation::getAutoGeneratedLocation ();
76
78
AllocStackInst *ASI = nullptr ;
77
79
SILType mappedType = remapType (OrigArg->getType ());
78
80
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend %s -O -enable-library-evolution -emit-ir -g
2
+
3
+ // REQUIRES: objc_interop
4
+ import Foundation
5
+
6
+ public struct MyThing { }
7
+
8
+ public struct ThingSequence : Sequence , IteratorProtocol {
9
+ private var enumerator : NSEnumerator ?
10
+
11
+ public init ( ) { }
12
+
13
+ public mutating func next( ) -> MyThing ? {
14
+ guard let enumerator = enumerator else { return nil }
15
+ guard let nextObject = enumerator. nextObject ( ) ,
16
+ let nextThing = nextObject as? MyThing else {
17
+ self . enumerator = nil
18
+ return nil
19
+ }
20
+ return nextThing
21
+ }
22
+ }
23
+
24
+ public struct Manager {
25
+ public func sequence( ) -> ThingSequence {
26
+ ThingSequence ( )
27
+ }
28
+ }
29
+
30
+ public func test( m: Manager ) {
31
+ for _ in m. sequence ( ) { }
32
+ }
You can’t perform that action at this time.
0 commit comments