Skip to content

Commit b362174

Browse files
committed
IRGen: Stricter contract for emitWitnessTableRef()
Again, let's just assert that we're emitting a reference to a witness table for the exact conformance provided. The inherited conformance case would not have handled indirect refinement, where R refines Q refines P, and we're asked to emit a witness table reference for P given a conformance to R.
1 parent 414a7bf commit b362174

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,9 +2347,7 @@ llvm::Value *irgen::emitWitnessTableRef(IRGenFunction &IGF,
23472347
// more concrete than we're expecting.
23482348
// TODO: make a best effort to devirtualize, maybe?
23492349
auto concreteConformance = conformance.getConcrete();
2350-
if (concreteConformance->getProtocol() != proto) {
2351-
concreteConformance = concreteConformance->getInheritedConformance(proto);
2352-
}
2350+
assert(concreteConformance->getProtocol() == proto);
23532351

23542352
// Check immediately for an existing cache entry.
23552353
auto wtable = IGF.tryGetLocalTypeData(

0 commit comments

Comments
 (0)