File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -602,9 +602,8 @@ class alignas(1 << TypeAlignInBits) TypeBase
602
602
603
603
bool isPlaceholder ();
604
604
605
- // / Returns true if this is a move only type. Returns false if this is a
606
- // / non-move only type or a move only wrapped type.
607
- bool isPureMoveOnly () const ;
605
+ // / Returns true if this is a move-only type.
606
+ bool isPureMoveOnly ();
608
607
609
608
// / Does the type have outer parenthesis?
610
609
bool hasParenSugar () const { return getKind () == TypeKind::Paren; }
Original file line number Diff line number Diff line change @@ -165,9 +165,17 @@ bool TypeBase::isAny() {
165
165
return constraint->isEqual (getASTContext ().TheAnyType );
166
166
}
167
167
168
- bool TypeBase::isPureMoveOnly () const {
169
- if (auto *nom = getCanonicalType ()-> getNominalOrBoundGenericNominal ())
168
+ bool TypeBase::isPureMoveOnly () {
169
+ if (auto *nom = getNominalOrBoundGenericNominal ())
170
170
return nom->isMoveOnly ();
171
+
172
+ // if any components of the tuple are move-only, then the tuple is move-only.
173
+ if (auto *tupl = getCanonicalType ()->getAs <TupleType>()) {
174
+ for (auto eltTy : tupl->getElementTypes ())
175
+ if (eltTy->isPureMoveOnly ())
176
+ return true ;
177
+ }
178
+
171
179
return false ;
172
180
}
173
181
Original file line number Diff line number Diff line change @@ -91,6 +91,9 @@ func testBasic(_ mo: MO) {
91
91
92
92
let singleton : ( MO ) = ( mo)
93
93
takeGeneric ( singleton) // expected-error {{move-only type 'MO' cannot be used with generics yet}}
94
+
95
+ takeAny ( ( mo) ) // expected-error {{move-only type 'MO' cannot be used with generics yet}}
96
+ takeAny ( ( mo, mo) ) // expected-error {{move-only type '(MO, MO)' cannot be used with generics yet}}
94
97
}
95
98
96
99
func checkBasicBoxes( ) {
You can’t perform that action at this time.
0 commit comments