Skip to content

Commit a68c806

Browse files
committed
Sema: Skip a legacy check when built with SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS
1 parent d737239 commit a68c806

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,19 +3889,21 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
38893889
return getTypeMatchAmbiguous();
38903890
}
38913891

3892-
// move-only types (and their metatypes) cannot match with existential types.
3893-
if (type1->getMetatypeInstanceType()->isNoncopyable()) {
3894-
// tailor error message
3895-
if (shouldAttemptFixes()) {
3896-
auto *fix = MustBeCopyable::create(*this,
3897-
type1,
3898-
NoncopyableMatchFailure::forExistentialCast(
3899-
type2),
3900-
getConstraintLocator(locator));
3901-
if (!recordFix(fix))
3902-
return getTypeMatchSuccess();
3892+
if (!SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS) {
3893+
// move-only types (and their metatypes) cannot match with existential types.
3894+
if (type1->getMetatypeInstanceType()->isNoncopyable()) {
3895+
// tailor error message
3896+
if (shouldAttemptFixes()) {
3897+
auto *fix = MustBeCopyable::create(*this,
3898+
type1,
3899+
NoncopyableMatchFailure::forExistentialCast(
3900+
type2),
3901+
getConstraintLocator(locator));
3902+
if (!recordFix(fix))
3903+
return getTypeMatchSuccess();
3904+
}
3905+
return getTypeMatchFailure(locator);
39033906
}
3904-
return getTypeMatchFailure(locator);
39053907
}
39063908

39073909
// FIXME: Feels like a hack.

0 commit comments

Comments
 (0)