Skip to content

Commit e2f10ed

Browse files
committed
RemoteInspection: Remove 'DidSubstitute' form of TypeRef::subst()
1 parent 726e152 commit e2f10ed

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
@@ -1350,15 +1350,12 @@ class TypeRefSubstitution
13501350
: public TypeRefVisitor<TypeRefSubstitution, const TypeRef *> {
13511351
TypeRefBuilder &Builder;
13521352
GenericArgumentMap Substitutions;
1353-
// Set true iff the Substitution map was actually used
1354-
bool DidSubstitute;
1353+
13551354
public:
13561355
using TypeRefVisitor<TypeRefSubstitution, const TypeRef *>::visit;
13571356

13581357
TypeRefSubstitution(TypeRefBuilder &Builder, GenericArgumentMap Substitutions)
1359-
: Builder(Builder), Substitutions(Substitutions), DidSubstitute(false) {}
1360-
1361-
bool didSubstitute() const { return DidSubstitute; }
1358+
: Builder(Builder), Substitutions(Substitutions) {}
13621359

13631360
const TypeRef *visitBuiltinTypeRef(const BuiltinTypeRef *B) {
13641361
return B;
@@ -1488,7 +1485,6 @@ class TypeRefSubstitution
14881485
if (found == Substitutions.end())
14891486
return GTP;
14901487
assert(found->second->isConcrete());
1491-
DidSubstitute = true; // We actually used the Substitutions
14921488

14931489
// When substituting a concrete type containing a metatype into a
14941490
// type parameter, (eg: T, T := C.Type), we must also represent
@@ -1609,15 +1605,6 @@ const TypeRef *TypeRef::subst(TypeRefBuilder &Builder,
16091605
return TypeRefSubstitution(Builder, Subs).visit(this);
16101606
}
16111607

1612-
const TypeRef *TypeRef::subst(TypeRefBuilder &Builder,
1613-
const GenericArgumentMap &Subs,
1614-
bool &DidSubstitute) const {
1615-
auto subst = TypeRefSubstitution(Builder, Subs);
1616-
auto TR = subst.visit(this);
1617-
DidSubstitute = subst.didSubstitute();
1618-
return TR;
1619-
}
1620-
16211608
bool TypeRef::deriveSubstitutions(GenericArgumentMap &Subs,
16221609
const TypeRef *OrigTR,
16231610
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)