Skip to content

Commit b9f1175

Browse files
committed
IRGen: Fix isDependentConformance() to resolve type witnesses if necessary
1 parent 18f216c commit b9f1175

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static bool hasDependentTypeWitness(
854854
return false;
855855

856856
// Check whether any of the associated types are dependent.
857-
if (conformance->forEachTypeWitness(nullptr,
857+
if (conformance->forEachTypeWitness(DC->getASTContext().getLazyResolver(),
858858
[&](AssociatedTypeDecl *requirement, Type type,
859859
TypeDecl *explicitDecl) -> bool {
860860
// Skip associated types that don't have witness table entries.

test/IRGen/Inputs/signature_conformances_other.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ protocol Q {
22
associatedtype T
33
}
44

5+
struct AlsoConforms<T> : Q {}
6+
7+
func takesQ<T : Q>(_: T) {}
8+
59
protocol P : Q {
610
associatedtype U
711
}

test/IRGen/signature_conformances_multifile.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
// Make sure we correctly determine the witness table is dependent, even though
44
// it was defined in a different file.
55

6+
// CHECK-LABEL: define hidden swiftcc void @"$s32signature_conformances_multifile5passQyyF"()
7+
func passQ() {
8+
// CHECK: call swiftcc void @"$s32signature_conformances_multifile12AlsoConformsVACyxGycfC"(%swift.type* @"$sSiN")
9+
// CHECK: %0 = call swiftcc %swift.metadata_response @"$s32signature_conformances_multifile12AlsoConformsVySiGMa"
10+
// CHECK: %1 = extractvalue %swift.metadata_response %0
11+
// CHECK: %2 = call i8** @"$s32signature_conformances_multifile12AlsoConformsVySiGACyxGAA1QAAWl"()
12+
// CHECK: call swiftcc void @"$s32signature_conformances_multifile6takesQyyxAA1QRzlF"(%swift.opaque* noalias nocapture undef, %swift.type* %1, i8** %2)
13+
takesQ(AlsoConforms<Int>())
14+
15+
// CHECK: ret void
16+
}
17+
618
// CHECK-LABEL: define hidden swiftcc void @"$s32signature_conformances_multifile5passPyyF"()
719
func passP() {
820
// CHECK: call swiftcc void @"$s32signature_conformances_multifile8ConformsVACyxq_GycfC"(%swift.type* @"$sSiN", %swift.type* @"$sSSN")

0 commit comments

Comments
 (0)