Skip to content

Commit b75e09c

Browse files
authored
Merge pull request #38494 from slavapestov/sil-verifier-dynamic-self
SIL: Fix verifier failure when witness_method's lookup type involves dynamic Self
2 parents 321a1ea + 8d65042 commit b75e09c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3163,7 +3163,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
31633163
"requirement Self parameter must conform to called protocol");
31643164

31653165
auto lookupType = AMI->getLookupType();
3166-
if (getOpenedArchetypeOf(lookupType) || isa<DynamicSelfType>(lookupType)) {
3166+
if (getOpenedArchetypeOf(lookupType) || lookupType->hasDynamicSelfType()) {
31673167
require(AMI->getTypeDependentOperands().size() == 1,
31683168
"Must have a type dependent operand for the opened archetype");
31693169
verifyOpenedArchetype(AMI, lookupType);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend -emit-sil %s
2+
3+
public class C {
4+
public func foo() -> Self {
5+
let arr = [self]
6+
7+
bar(arr)
8+
9+
return self
10+
}
11+
}
12+
13+
@_transparent public func bar<T : Sequence>(_ xs: T) {
14+
for x in xs { _ = x }
15+
}

0 commit comments

Comments
 (0)