Skip to content

Commit d807198

Browse files
committed
[NCGenerics] fix missing contextual type
1 parent f0e17af commit d807198

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/SIL/IR/SIL.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ bool SILModule::isTypeMetadataForLayoutAccessible(SILType type) {
296296
return ::isTypeMetadataForLayoutAccessible(*this, type);
297297
}
298298

299-
static bool isUnsupportedKeyPathValueType(Type ty) {
299+
static bool isUnsupportedKeyPathValueType(Type ty, GenericEnvironment *env) {
300300
// Visit lowered positions.
301301
if (auto tupleTy = ty->getAs<TupleType>()) {
302302
for (auto eltTy : tupleTy->getElementTypes()) {
303303
if (eltTy->is<PackExpansionType>())
304304
return true;
305305

306-
if (isUnsupportedKeyPathValueType(eltTy))
306+
if (isUnsupportedKeyPathValueType(eltTy, env))
307307
return true;
308308
}
309309

@@ -321,19 +321,19 @@ static bool isUnsupportedKeyPathValueType(Type ty) {
321321
if (paramTy->is<PackExpansionType>())
322322
return true;
323323

324-
if (isUnsupportedKeyPathValueType(paramTy))
324+
if (isUnsupportedKeyPathValueType(paramTy, env))
325325
return true;
326326
}
327327

328-
if (isUnsupportedKeyPathValueType(funcTy->getResult()))
328+
if (isUnsupportedKeyPathValueType(funcTy->getResult(), env))
329329
return true;
330330
}
331331

332332
// Noncopyable types aren't supported by key paths in their current form.
333333
// They would also need a new ABI that's yet to be implemented in order to
334334
// be properly supported, so let's suppress the descriptor for now if either
335335
// the container or storage type of the declaration is non-copyable.
336-
if (ty->isNoncopyable())
336+
if (ty->isNoncopyable(env))
337337
return true;
338338

339339
return false;
@@ -398,7 +398,8 @@ bool AbstractStorageDecl::exportsPropertyDescriptor() const {
398398
llvm_unreachable("should be definition linkage?");
399399
}
400400

401-
if (isUnsupportedKeyPathValueType(getValueInterfaceType())) {
401+
auto *env = getDeclContext()->getGenericEnvironmentOfContext();
402+
if (isUnsupportedKeyPathValueType(getValueInterfaceType(), env)) {
402403
return false;
403404
}
404405

0 commit comments

Comments
 (0)