@@ -296,14 +296,14 @@ bool SILModule::isTypeMetadataForLayoutAccessible(SILType type) {
296
296
return ::isTypeMetadataForLayoutAccessible (*this , type);
297
297
}
298
298
299
- static bool isUnsupportedKeyPathValueType (Type ty, GenericEnvironment *env ) {
299
+ static bool isUnsupportedKeyPathValueType (Type ty) {
300
300
// Visit lowered positions.
301
301
if (auto tupleTy = ty->getAs <TupleType>()) {
302
302
for (auto eltTy : tupleTy->getElementTypes ()) {
303
303
if (eltTy->is <PackExpansionType>())
304
304
return true ;
305
305
306
- if (isUnsupportedKeyPathValueType (eltTy, env ))
306
+ if (isUnsupportedKeyPathValueType (eltTy))
307
307
return true ;
308
308
}
309
309
@@ -321,19 +321,19 @@ static bool isUnsupportedKeyPathValueType(Type ty, GenericEnvironment *env) {
321
321
if (paramTy->is <PackExpansionType>())
322
322
return true ;
323
323
324
- if (isUnsupportedKeyPathValueType (paramTy, env ))
324
+ if (isUnsupportedKeyPathValueType (paramTy))
325
325
return true ;
326
326
}
327
327
328
- if (isUnsupportedKeyPathValueType (funcTy->getResult (), env ))
328
+ if (isUnsupportedKeyPathValueType (funcTy->getResult ()))
329
329
return true ;
330
330
}
331
331
332
332
// Noncopyable types aren't supported by key paths in their current form.
333
333
// They would also need a new ABI that's yet to be implemented in order to
334
334
// be properly supported, so let's suppress the descriptor for now if either
335
335
// the container or storage type of the declaration is non-copyable.
336
- if (ty->isNoncopyable (env ))
336
+ if (ty->isNoncopyable ())
337
337
return true ;
338
338
339
339
return false ;
@@ -398,8 +398,11 @@ bool AbstractStorageDecl::exportsPropertyDescriptor() const {
398
398
llvm_unreachable (" should be definition linkage?" );
399
399
}
400
400
401
- auto *env = getDeclContext ()->getGenericEnvironmentOfContext ();
402
- if (isUnsupportedKeyPathValueType (getValueInterfaceType (), env)) {
401
+ auto valueType = getValueInterfaceType ();
402
+ if (auto *env = getDeclContext ()->getGenericEnvironmentOfContext ())
403
+ valueType = env->mapTypeIntoContext (valueType);
404
+
405
+ if (isUnsupportedKeyPathValueType (valueType)) {
403
406
return false ;
404
407
}
405
408
0 commit comments