@@ -6273,16 +6273,17 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
6273
6273
OptionalType::get (resolvedTy->getWithoutSpecifierType ()));
6274
6274
6275
6275
// AnyHashable
6276
- typesToCheck.push_back (ctx.getAnyHashableDecl ()->getDeclaredInterfaceType ());
6276
+ if (auto *anyHashable = ctx.getAnyHashableDecl ())
6277
+ typesToCheck.push_back (anyHashable->getDeclaredInterfaceType ());
6277
6278
6278
6279
// Rest of the implicit conversions depend on the resolved type.
6279
- {
6280
- auto *ptrDecl = ctx.getUnsafePointerDecl ();
6281
-
6280
+ if (auto *ptrDecl = ctx.getUnsafePointerDecl ()) {
6282
6281
// String -> UnsafePointer<Void>
6283
- if (resolvedTy->isEqual (ctx.getStringDecl ()->getDeclaredInterfaceType ())) {
6284
- typesToCheck.push_back (BoundGenericType::get (ptrDecl, /* parent=*/ Type (),
6285
- {ctx.TheEmptyTupleType }));
6282
+ if (auto *string = ctx.getStringDecl ()) {
6283
+ if (resolvedTy->isEqual (string->getDeclaredInterfaceType ())) {
6284
+ typesToCheck.push_back (BoundGenericType::get (ptrDecl, /* parent=*/ Type (),
6285
+ {ctx.TheEmptyTupleType }));
6286
+ }
6286
6287
}
6287
6288
6288
6289
// Array<T> -> UnsafePointer<T>
@@ -6295,8 +6296,10 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
6295
6296
if (type->is <InOutType>()) {
6296
6297
typesToCheck.push_back (
6297
6298
BoundGenericType::get (ptrDecl, /* parent=*/ Type (), {resolvedTy}));
6298
- typesToCheck.push_back (BoundGenericType::get (
6299
- ctx.getUnsafeMutablePointerDecl (), /* parent=*/ Type (), {resolvedTy}));
6299
+
6300
+ if (auto *mutablePtr = ctx.getUnsafeMutablePointerDecl ())
6301
+ typesToCheck.push_back (
6302
+ BoundGenericType::get (mutablePtr, /* parent=*/ Type (), {resolvedTy}));
6300
6303
}
6301
6304
}
6302
6305
0 commit comments