@@ -8016,12 +8016,9 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
8016
8016
irWitnessTableBaseType,
8017
8017
irWitnessTable->getConcreteType());
8018
8018
8019
- // TODO: When WitnessTable became HOISTABLE, we needed a way to avoid
8020
- // adding the same decorations and childrens redundantly.
8021
- // There isn't an easy way to tell if the returned WitnessTable is a
8022
- // brand new or a found one from the existing pool.
8023
- // The code below assumes that when there are any decoration or child,
8024
- // it is a pre-existed one.
8019
+ // Since IRWitnessTable is Hoistable, `createWitnessTable()` may return a
8020
+ // pre-existing one. We need to avoid adding the same decorations/children
8021
+ // when the IRWitnessTable already has them.
8025
8022
//
8026
8023
if (irSatisfyingWitnessTable->getFirstDecorationOrChild() == nullptr)
8027
8024
{
@@ -8167,12 +8164,9 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
8167
8164
// Create the IR-level witness table
8168
8165
auto irWitnessTable = subBuilder->createWitnessTable(irWitnessTableBaseType, irSubType);
8169
8166
8170
- // TODO: When WitnessTable became HOISTABLE, we needed a way to avoid
8171
- // adding the same decorations and childrens redundantly.
8172
- // There isn't an easy way to tell if the returned WitnessTable is a
8173
- // brand new or a found one from the existing pool.
8174
- // The code below assumes that when there are any decoration or child,
8175
- // it is a pre-existed one.
8167
+ // Since IRWitnessTable is Hoistable, `createWitnessTable()` may return a
8168
+ // pre-existing one. We need to avoid adding the same decorations/children
8169
+ // when the IRWitnessTable already has them.
8176
8170
//
8177
8171
if (irWitnessTable->getFirstDecorationOrChild() == nullptr)
8178
8172
{
0 commit comments