@@ -3026,6 +3026,13 @@ static bool diagnoseIsolatedAnyAvailability(
3026
3026
3027
3027
static bool diagnoseNoncopyableGenericsAvailability (
3028
3028
SourceRange ReferenceRange, const DeclContext *ReferenceDC) {
3029
+ // Do not check availability in the stdlib.
3030
+ // FIXME: would be better if we had an attribute on each decl that opt's out
3031
+ // of availability checking in the stdlib, because it's been audited or
3032
+ // automatically checked to ensure it doesn't use the metadata.
3033
+ // if (ReferenceDC->getParentModule()->isStdlibModule())
3034
+ // return false;
3035
+
3029
3036
return TypeChecker::checkAvailability (
3030
3037
ReferenceRange,
3031
3038
ReferenceDC->getASTContext ().getNoncopyableGenericsAvailability (),
@@ -3044,6 +3051,7 @@ static bool inverseGenericsOldRuntimeCompatable(BoundGenericType *boundTy) {
3044
3051
case InvertibleProtocolKind::Copyable:
3045
3052
if (arg->isNoncopyable ())
3046
3053
return false ;
3054
+ break ;
3047
3055
case InvertibleProtocolKind::Escapable:
3048
3056
if (!arg->isEscapable ())
3049
3057
return false ;
@@ -3088,8 +3096,12 @@ static bool checkTypeMetadataAvailabilityInternal(CanType type,
3088
3096
auto isolation = fnType->getIsolation ();
3089
3097
if (isolation.isErased ())
3090
3098
return diagnoseIsolatedAnyAvailability (refLoc, refDC);
3091
- } else if (auto nominalTy = dyn_cast<NominalOrBoundGenericNominalType>(type)) {
3092
- if (requiresNoncopyableGenericsAvailabilityCheck (nominalTy))
3099
+ // } else if (auto nominalTy = dyn_cast<NominalOrBoundGenericNominalType>(type)) {
3100
+ // if (requiresNoncopyableGenericsAvailabilityCheck(nominalTy))
3101
+ // return diagnoseNoncopyableGenericsAvailability(refLoc, refDC);
3102
+ // // llvm_unreachable("did hit this case!");
3103
+ } else if (auto archeType = dyn_cast<ArchetypeType>(type)) {
3104
+ if (archeType->isNoncopyable ())
3093
3105
return diagnoseNoncopyableGenericsAvailability (refLoc, refDC);
3094
3106
}
3095
3107
return false ;
0 commit comments