File tree 3 files changed +37
-3
lines changed
3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -2520,10 +2520,11 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
2520
2520
PrintOptions QualifiedSILTypeOptions =
2521
2521
PrintOptions::printQualifiedSILType ();
2522
2522
QualifiedSILTypeOptions.CurrentModule = WMI->getModule ().getSwiftModule ();
2523
- *this << " $" << WMI->getLookupType () << " , " << WMI->getMember () << " : " ;
2523
+ auto lookupType = WMI->getLookupType ();
2524
+ *this << " $" << lookupType << " , " << WMI->getMember () << " : " ;
2524
2525
WMI->getMember ().getDecl ()->getInterfaceType ().print (
2525
2526
PrintState.OS , QualifiedSILTypeOptions);
2526
- if (!WMI->getTypeDependentOperands ().empty ()) {
2527
+ if (( getLocalArchetypeOf (lookupType) || lookupType-> hasDynamicSelfType ()) && !WMI->getTypeDependentOperands ().empty ()) {
2527
2528
*this << " , " ;
2528
2529
*this << getIDAndForcedPrintedType (WMI->getTypeDependentOperands ()[0 ].get ());
2529
2530
}
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