Skip to content

Commit 01dac33

Browse files
committed
Remove this over-eager assertion about transforming subst SILFunctionType.
It was firing on mapping a SILFunctionType from pack to element context. I could've updated that, but honestly it's just not a very good assertion. The most likely source of errors here is already prevented by the assertion about substituting a SILFunctionType with AST-level substitution. Otherwise we're just interfering with the implementation of reasonable AST-level transforms.
1 parent 91acf1d commit 01dac33

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

lib/AST/Type.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5311,28 +5311,16 @@ case TypeKind::Id:
53115311
case TypeKind::SILFunction: {
53125312
auto fnTy = cast<SILFunctionType>(base);
53135313
bool changed = false;
5314-
auto hasTypeErasedGenericClassType = [](Type ty) -> bool {
5315-
return ty.findIf([](Type subType) -> bool {
5316-
if (subType->isTypeErasedGenericClassType())
5317-
return true;
5318-
else
5319-
return false;
5320-
});
5321-
};
53225314
auto updateSubs = [&](SubstitutionMap &subs) -> bool {
5323-
// This interface isn't suitable for updating the substitution map in a
5324-
// substituted SILFunctionType.
5325-
// TODO(SILFunctionType): Is it suitable for any SILFunctionType??
5315+
// This interface isn't suitable for doing most transformations on
5316+
// a substituted SILFunctionType, but it's too hard to come up with
5317+
// an assertion that meaningfully captures what restrictions are in
5318+
// place. Generally the restriction that you can't naively substitute
5319+
// a SILFunctionType using AST mechanisms will have to be good enough.
53265320
SmallVector<Type, 4> newReplacements;
53275321
for (Type type : subs.getReplacementTypes()) {
53285322
auto transformed =
53295323
type.transformWithPosition(TypePosition::Invariant, fn);
5330-
assert((type->isEqual(transformed) ||
5331-
(type->hasTypeParameter() && transformed->hasTypeParameter()) ||
5332-
(hasTypeErasedGenericClassType(type) &&
5333-
hasTypeErasedGenericClassType(transformed))) &&
5334-
"Substituted SILFunctionType can't be transformed into a "
5335-
"concrete type");
53365324
newReplacements.push_back(transformed->getCanonicalType());
53375325
if (!type->isEqual(transformed))
53385326
changed = true;

0 commit comments

Comments
 (0)