mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
describe illegal casts to existentials
This commit is contained in:
@@ -3832,8 +3832,11 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
|
||||
if (type1->getMetatypeInstanceType()->isPureMoveOnly()) {
|
||||
// tailor error message
|
||||
if (shouldAttemptFixes()) {
|
||||
auto *fix = MustBeCopyable::create(*this, type1,
|
||||
getConstraintLocator(locator));
|
||||
auto *fix =
|
||||
MustBeCopyable::create(*this, type1,
|
||||
{type2,
|
||||
NoncopyableMatchFailure::CastToExistential},
|
||||
getConstraintLocator(locator));
|
||||
if (!recordFix(fix))
|
||||
return getTypeMatchSuccess();
|
||||
}
|
||||
@@ -8492,7 +8495,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
// If this is a failure to conform to Copyable, tailor the error message.
|
||||
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
|
||||
auto *fix =
|
||||
MustBeCopyable::create(*this, type, getConstraintLocator(locator));
|
||||
MustBeCopyable::create(*this, type, {}, getConstraintLocator(locator));
|
||||
if (!recordFix(fix))
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user