@@ -6273,16 +6273,17 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
62736273 OptionalType::get (resolvedTy->getWithoutSpecifierType ()));
62746274
62756275 // AnyHashable
6276- typesToCheck.push_back (ctx.getAnyHashableDecl ()->getDeclaredInterfaceType ());
6276+ if (auto *anyHashable = ctx.getAnyHashableDecl ())
6277+ typesToCheck.push_back (anyHashable->getDeclaredInterfaceType ());
62776278
62786279 // Rest of the implicit conversions depend on the resolved type.
6279- {
6280- auto *ptrDecl = ctx.getUnsafePointerDecl ();
6281-
6280+ if (auto *ptrDecl = ctx.getUnsafePointerDecl ()) {
62826281 // 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+ }
62866287 }
62876288
62886289 // Array<T> -> UnsafePointer<T>
@@ -6295,8 +6296,10 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
62956296 if (type->is <InOutType>()) {
62966297 typesToCheck.push_back (
62976298 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}));
63006303 }
63016304 }
63026305
0 commit comments