@@ -181,29 +181,20 @@ static bool alwaysNoncopyable(Type ty) {
181
181
// / context to substitute unbound types.
182
182
bool TypeBase::isNoncopyable (const DeclContext *dc) {
183
183
assert (dc);
184
+ auto &ctx = dc->getASTContext ();
184
185
185
- /* * FIXME: seems this is busted :(
186
- // Fast-path for type parameters; ask the generic signature directly and
187
- // cache that answer.
188
- if (isTypeParameter()) {
186
+ // Fast-path for type parameters; ask the generic signature directly.
187
+ if (isTypeParameter () &&
188
+ ctx.LangOpts .hasFeature (Feature::NoncopyableGenerics)) {
189
189
auto canType = getCanonicalType ();
190
- auto &ctx = canType->getASTContext();
191
- IsNoncopyableRequest req {canType};
192
190
193
- if (ctx.evaluator.hasCachedResult(req))
194
- return evaluateOrDefault(ctx.evaluator, req, true);
195
-
196
- auto *copyableProto = ctx.getProtocol(KnownProtocolKind::Copyable);
197
- if (!copyableProto)
191
+ auto *copyable = ctx.getProtocol (KnownProtocolKind::Copyable);
192
+ if (!copyable)
198
193
llvm_unreachable (" missing Copyable protocol!" );
199
194
200
195
auto sig = dc->getGenericSignatureOfContext ();
201
- bool isNoncopyable = !sig->requiresProtocol(canType, copyableProto);
202
- ctx.evaluator.cacheOutput(req, isNoncopyable == true);
203
-
204
- return isNoncopyable;
196
+ return !sig->requiresProtocol (canType, copyable);
205
197
}
206
- */
207
198
208
199
if (!hasArchetype () || hasOpenedExistential ())
209
200
// TODO: the need for the following test is suspicious.
0 commit comments