Merge pull request #65606 from kavon/noncopyable-metatypes

Prevent noncopyable metatypes from being converted to `Any`
This commit is contained in:
Kavon Farvardin
2023-05-03 22:05:17 -07:00
committed by GitHub
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,