Skip to content

Commit 7bf570d

Browse files
committed
NCGenerics: conformance to Any does not always hold
`Any` now implies the requirements `Copyable & Escapable`. Check it like any ordinary existential.
1 parent d768c75 commit 7bf570d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3914,11 +3914,9 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
39143914
// we need to disallow conversions from types containing @noescape
39153915
// functions to Any.
39163916

3917-
// Conformance to 'Any' always holds.
3918-
if (type2->isAny()) {
3919-
if (!type1->isNoEscape())
3920-
return getTypeMatchSuccess();
3921-
3917+
// FIXME: special case for nonescaping functions and tuples containing them
3918+
// shouldn't be needed, as functions have conformances to Escapable/Copyable.
3919+
if (type2->isAny() && type1->isNoEscape()) {
39223920
if (shouldAttemptFixes()) {
39233921
auto *fix = MarkExplicitlyEscaping::create(*this, type1, type2,
39243922
getConstraintLocator(locator));

0 commit comments

Comments
 (0)