Skip to content

Commit 9bbb8e8

Browse files
committed
[CoroutineAccessors] Set field on RequirementMatch
The WitnessSubstitutions field must be set to the appropriate substitution map.
1 parent 29315e6 commit 9bbb8e8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6850,6 +6850,7 @@ void TypeChecker::inferDefaultWitnesses(ProtocolDecl *proto) {
68506850
RequirementEnvironment reqEnv(proto, reqSig, proto, nullptr, nullptr);
68516851
auto match =
68526852
RequirementMatch(asd, MatchKind::ExactMatch, asdTy, reqEnv);
6853+
match.WitnessSubstitutions = reqEnv.getRequirementToWitnessThunkSubs();
68536854
checker.recordWitness(asd, match);
68546855
}
68556856
}

test/SILGen/coroutine_accessors.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,13 @@ class OverridableReader : GettableTitle {
235235
}
236236
}
237237
}
238+
239+
// CHECK-LABEL: sil_default_witness_table ReadableField {
240+
// CHECK-NEXT: no_default
241+
// CHECK-NEXT: method #ReadableField.field!read2
242+
// CHECK-SAME: : @$s19coroutine_accessors13ReadableFieldP5fieldSivy
243+
// CHECK-NEXT: }
244+
public protocol ReadableField {
245+
@_borrowed
246+
var field: Int { get }
247+
}

0 commit comments

Comments
 (0)