Skip to content

SIL: Fix verifier failure when witness_method's lookup type involves dynamic Self [5.5] #38495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/SIL/Verifier/SILVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3182,7 +3182,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
"requirement Self parameter must conform to called protocol");

auto lookupType = AMI->getLookupType();
if (getOpenedArchetypeOf(lookupType) || isa<DynamicSelfType>(lookupType)) {
if (getOpenedArchetypeOf(lookupType) || lookupType->hasDynamicSelfType()) {
require(AMI->getTypeDependentOperands().size() == 1,
"Must have a type dependent operand for the opened archetype");
verifyOpenedArchetype(AMI, lookupType);
Expand Down
15 changes: 15 additions & 0 deletions validation-test/compiler_crashers_2_fixed/rdar80296242.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %target-swift-frontend -emit-sil %s

public class C {
public func foo() -> Self {
let arr = [self]

bar(arr)

return self
}
}

@_transparent public func bar<T : Sequence>(_ xs: T) {
for x in xs { _ = x }
}