Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sema] NFC: Delete dead superclass coercion logic #22945

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 6 additions & 26 deletions lib/Sema/CSApply.cpp
Expand Up @@ -6570,32 +6570,6 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
break;
}

case TypeKind::PrimaryArchetype:
case TypeKind::OpenedArchetype:
case TypeKind::NestedArchetype:
if (!cast<ArchetypeType>(desugaredFromType)->requiresClass())
break;
LLVM_FALLTHROUGH;

// Coercion from a subclass to a superclass.
//
// FIXME: Can we rig things up so that we always have a Superclass
// conversion restriction in this case?
case TypeKind::DynamicSelf:
case TypeKind::BoundGenericClass:
case TypeKind::Class: {
if (!toType->getClassOrBoundGenericClass())
break;
for (auto fromSuperClass = fromType->getSuperclass();
fromSuperClass;
fromSuperClass = fromSuperClass->getSuperclass()) {
if (fromSuperClass->isEqual(toType)) {
return coerceSuperclass(expr, toType, locator);
}
}
break;
}

// Coercion from one function type to another, this produces a
// FunctionConversionExpr in its full generality.
case TypeKind::Function: {
Expand Down Expand Up @@ -6715,6 +6689,12 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
case TypeKind::GenericFunction:
case TypeKind::GenericTypeParam:
case TypeKind::DependentMember:
case TypeKind::PrimaryArchetype:
case TypeKind::OpenedArchetype:
case TypeKind::NestedArchetype:
case TypeKind::DynamicSelf:
case TypeKind::BoundGenericClass:
case TypeKind::Class:
break;
}

Expand Down