Skip to content

Commit 2184ed2

Browse files
committed
[nfc] refactor isUnsupportedKeyPathValueType
1 parent 8178eb0 commit 2184ed2

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, GenericEnvironment *env) {
299+
static bool isUnsupportedKeyPathValueType(Type ty) {
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, env))
306+
if (isUnsupportedKeyPathValueType(eltTy))
307307
return true;
308308
}
309309

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

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

328-
if (isUnsupportedKeyPathValueType(funcTy->getResult(), env))
328+
if (isUnsupportedKeyPathValueType(funcTy->getResult()))
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(env))
336+
if (ty->isNoncopyable())
337337
return true;
338338

339339
return false;
@@ -399,7 +399,8 @@ bool AbstractStorageDecl::exportsPropertyDescriptor() const {
399399
}
400400

401401
auto *env = getDeclContext()->getGenericEnvironmentOfContext();
402-
if (isUnsupportedKeyPathValueType(getValueInterfaceType(), env)) {
402+
auto contextualType = env->mapTypeIntoContext(getValueInterfaceType());
403+
if (isUnsupportedKeyPathValueType(contextualType)) {
403404
return false;
404405
}
405406

0 commit comments

Comments
 (0)