Skip to content

Commit a4c9b89

Browse files
authored
Merge pull request #38495 from slavapestov/sil-verifier-dynamic-self-5.5
SIL: Fix verifier failure when witness_method's lookup type involves dynamic Self [5.5]
2 parents 7a6b8d1 + 4703a9d commit a4c9b89

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
@@ -3182,7 +3182,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
31823182
"requirement Self parameter must conform to called protocol");
31833183

31843184
auto lookupType = AMI->getLookupType();
3185-
if (getOpenedArchetypeOf(lookupType) || isa<DynamicSelfType>(lookupType)) {
3185+
if (getOpenedArchetypeOf(lookupType) || lookupType->hasDynamicSelfType()) {
31863186
require(AMI->getTypeDependentOperands().size() == 1,
31873187
"Must have a type dependent operand for the opened archetype");
31883188
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)