File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -2459,10 +2459,11 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
2459
2459
PrintOptions QualifiedSILTypeOptions =
2460
2460
PrintOptions::printQualifiedSILType ();
2461
2461
QualifiedSILTypeOptions.CurrentModule = WMI->getModule ().getSwiftModule ();
2462
- *this << " $" << WMI->getLookupType () << " , " << WMI->getMember () << " : " ;
2462
+ auto lookupType = WMI->getLookupType ();
2463
+ *this << " $" << lookupType << " , " << WMI->getMember () << " : " ;
2463
2464
WMI->getMember ().getDecl ()->getInterfaceType ().print (
2464
2465
PrintState.OS , QualifiedSILTypeOptions);
2465
- if (!WMI->getTypeDependentOperands ().empty ()) {
2466
+ if (( getLocalArchetypeOf (lookupType) || lookupType-> hasDynamicSelfType ()) && !WMI->getTypeDependentOperands ().empty ()) {
2466
2467
*this << " , " ;
2467
2468
*this << getIDAndType (WMI->getTypeDependentOperands ()[0 ].get ());
2468
2469
}
Original file line number Diff line number Diff line change @@ -4177,7 +4177,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
4177
4177
" Must have a type dependent operand for the opened archetype" );
4178
4178
verifyLocalArchetype (AMI, lookupType);
4179
4179
} else {
4180
- require (AMI->getTypeDependentOperands ().empty (),
4180
+ require (AMI->getTypeDependentOperands ().empty () || lookupType-> hasLocalArchetype () ,
4181
4181
" Should not have an operand for the opened existential" );
4182
4182
}
4183
4183
if (!isa<ArchetypeType>(lookupType) && !isa<DynamicSelfType>(lookupType)) {
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all) | %FileCheck %s
2
+
3
+ protocol P { }
4
+ extension P {
5
+ func foo( ) -> some Sequence < Int > {
6
+ [ 1 , 2 , 3 ]
7
+ }
8
+ }
9
+
10
+ struct B {
11
+ let p : P
12
+
13
+ @inline ( never)
14
+ func bar( ) {
15
+ for x in p. foo ( ) {
16
+ print ( x)
17
+ }
18
+ }
19
+ }
20
+
21
+
22
+ struct S : P {
23
+ var x = 0
24
+ }
25
+
26
+
27
+ let b = B ( p: S ( ) )
28
+
29
+ // CHECK: 1
30
+ // CHECK-NEXT: 2
31
+ // CHECK-NEXT: 3
32
+ b. bar ( )
33
+
You can’t perform that action at this time.
0 commit comments