File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -8200,6 +8200,21 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
8200
8200
return SolutionKind::Solved;
8201
8201
}
8202
8202
8203
+ // Copyable is checked structurally, so for better performance, split apart
8204
+ // this constraint into individual Copyable constraints on each tuple element.
8205
+ if (auto *tupleType = type->getAs<TupleType>()) {
8206
+ if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
8207
+ for (unsigned i = 0, e = tupleType->getNumElements(); i < e; ++i) {
8208
+ addConstraint(ConstraintKind::ConformsTo,
8209
+ tupleType->getElementType(i),
8210
+ protocol->getDeclaredInterfaceType(),
8211
+ locator.withPathElement(LocatorPathElt::TupleElement(i)));
8212
+ }
8213
+
8214
+ return SolutionKind::Solved;
8215
+ }
8216
+ }
8217
+
8203
8218
auto *loc = getConstraintLocator(locator);
8204
8219
8205
8220
/// Record the given conformance as the result, adding any conditional
Original file line number Diff line number Diff line change @@ -88,8 +88,8 @@ func testBasic(_ mo: borrowing MO) {
88
88
genericVarArg ( 5 )
89
89
genericVarArg ( mo) // expected-error {{move-only type 'MO' cannot be used with generics yet}}
90
90
91
- takeGeneric ( ( mo, 5 ) ) // expected-error {{global function 'takeGeneric' requires that 'MO' conform to '_Copyable' }}
92
- takeGenericSendable ( ( mo, mo) ) // expected-error 2{{global function 'takeGenericSendable' requires that 'MO' conform to '_Copyable' }}
91
+ takeGeneric ( ( mo, 5 ) ) // expected-error {{move-only type 'MO' cannot be used with generics yet }}
92
+ takeGenericSendable ( ( mo, mo) ) // expected-error 2{{move-only type 'MO' cannot be used with generics yet }}
93
93
94
94
let singleton : ( MO ) = ( mo)
95
95
takeGeneric ( singleton) // expected-error {{move-only type 'MO' cannot be used with generics yet}}
You can’t perform that action at this time.
0 commit comments