Revert "Revert "Prevent noncopyable metatypes from being converted to Any""

This reverts commit 1a3b42cd63.
This commit is contained in:
Kavon Farvardin
2023-05-04 11:38:00 -07:00
parent bd1cc4c64f
commit 103bd043cd
6 changed files with 41 additions and 15 deletions

View File

@@ -3834,8 +3834,8 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
return getTypeMatchAmbiguous();
}
// move-only types cannot match with any existential types.
if (type1->isPureMoveOnly()) {
// move-only types (and their metatypes) cannot match with existential types.
if (type1->getMetatypeInstanceType()->isPureMoveOnly()) {
// tailor error message
if (shouldAttemptFixes()) {
auto *fix = MustBeCopyable::create(*this, type1,