Skip to content

Commit c205c80

Browse files
committed
RemoteInspection: Remove 'DidSubstitute' form of TypeRef::subst()
1 parent 31947d0 commit c205c80

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

include/swift/RemoteInspection/TypeRef.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ class alignas(8) TypeRef {
238238
const TypeRef *subst(TypeRefBuilder &Builder,
239239
const GenericArgumentMap &Subs) const;
240240

241-
const TypeRef *subst(TypeRefBuilder &Builder,
242-
const GenericArgumentMap &Subs,
243-
bool &DidSubstitute) const;
244-
245241
std::optional<GenericArgumentMap> getSubstMap() const;
246242

247243
virtual ~TypeRef() = default;

stdlib/public/RemoteInspection/TypeRef.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,15 +1357,12 @@ class TypeRefSubstitution
13571357
: public TypeRefVisitor<TypeRefSubstitution, const TypeRef *> {
13581358
TypeRefBuilder &Builder;
13591359
GenericArgumentMap Substitutions;
1360-
// Set true iff the Substitution map was actually used
1361-
bool DidSubstitute;
1360+
13621361
public:
13631362
using TypeRefVisitor<TypeRefSubstitution, const TypeRef *>::visit;
13641363

13651364
TypeRefSubstitution(TypeRefBuilder &Builder, GenericArgumentMap Substitutions)
1366-
: Builder(Builder), Substitutions(Substitutions), DidSubstitute(false) {}
1367-
1368-
bool didSubstitute() const { return DidSubstitute; }
1365+
: Builder(Builder), Substitutions(Substitutions) {}
13691366

13701367
const TypeRef *visitBuiltinTypeRef(const BuiltinTypeRef *B) {
13711368
return B;
@@ -1495,7 +1492,6 @@ class TypeRefSubstitution
14951492
if (found == Substitutions.end())
14961493
return GTP;
14971494
assert(found->second->isConcrete());
1498-
DidSubstitute = true; // We actually used the Substitutions
14991495

15001496
// When substituting a concrete type containing a metatype into a
15011497
// type parameter, (eg: T, T := C.Type), we must also represent
@@ -1616,15 +1612,6 @@ const TypeRef *TypeRef::subst(TypeRefBuilder &Builder,
16161612
return TypeRefSubstitution(Builder, Subs).visit(this);
16171613
}
16181614

1619-
const TypeRef *TypeRef::subst(TypeRefBuilder &Builder,
1620-
const GenericArgumentMap &Subs,
1621-
bool &DidSubstitute) const {
1622-
auto subst = TypeRefSubstitution(Builder, Subs);
1623-
auto TR = subst.visit(this);
1624-
DidSubstitute = subst.didSubstitute();
1625-
return TR;
1626-
}
1627-
16281615
bool TypeRef::deriveSubstitutions(GenericArgumentMap &Subs,
16291616
const TypeRef *OrigTR,
16301617
const TypeRef *SubstTR) {

stdlib/public/RemoteInspection/TypeRefBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,9 @@ bool TypeRefBuilder::getFieldTypeRefs(
538538
// We need this for enums; an enum case "is generic" if any generic type
539539
// parameter substitutions occurred on the payload. E.g.,
540540
// `case a([T?])` is generic, but `case a([Int?])` is not.
541-
bool IsGeneric = false;
542-
auto Substituted = Unsubstituted->subst(*this, *Subs, IsGeneric);
541+
bool IsGeneric = !Unsubstituted->isConcrete();
542+
auto Substituted = (IsGeneric ? Unsubstituted->subst(*this, *Subs)
543+
: Unsubstituted);
543544
bool IsIndirect = FD.isEnum() && Field->IsIndirectCase;
544545

545546
auto FieldTI = FieldTypeInfo(FieldName.str(), FieldValue, Substituted,

0 commit comments

Comments
 (0)