Sema: Change a few AnyFunctionType => FunctionType

There can't actually be GenericFunctionTypes in the constraint system itself.
This commit is contained in:
Slava Pestov
2018-08-23 00:34:48 -07:00
parent 7b41a7a63e
commit 1c5452df6f

View File

@@ -1403,7 +1403,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
// Conformance to 'Any' always holds.
if (type2->isAny()) {
auto *fnTy = type1->getAs<AnyFunctionType>();
auto *fnTy = type1->getAs<FunctionType>();
if (!fnTy || !fnTy->isNoEscape())
return getTypeMatchSuccess();
@@ -1602,7 +1602,7 @@ ConstraintSystem::matchTypesBindTypeVar(
// Disallow bindings of noescape functions to type variables that
// represent an opened archetype. If we allowed this it would allow
// the noescape function to potentially escape.
if (auto *fnTy = type->getAs<AnyFunctionType>()) {
if (auto *fnTy = type->getAs<FunctionType>()) {
if (fnTy->isNoEscape() && typeVar->getImpl().getArchetype()) {
if (shouldAttemptFixes()) {
auto *fix = MarkExplicitlyEscaping::create(
@@ -2136,7 +2136,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
// Penalize conversions to Any, and disallow conversions of
// noescape functions to Any.
if (kind >= ConstraintKind::Conversion && type2->isAny()) {
if (auto *fnTy = type1->getAs<AnyFunctionType>()) {
if (auto *fnTy = type1->getAs<FunctionType>()) {
if (fnTy->isNoEscape()) {
if (shouldAttemptFixes()) {
auto &ctx = getASTContext();