@@ -3471,26 +3471,25 @@ SerializeAttrGenericSignatureRequest::evaluate(Evaluator &evaluator,
34713471 // Check the validity of provided requirements.
34723472 checkSpecializeAttrRequirements (attr, genericSig, specializedSig, Ctx);
34733473
3474- if (Ctx.LangOpts .hasFeature (Feature::LayoutPrespecialization)) {
3475- llvm::SmallVector<Type, 4 > typeErasedParams;
3476- for (const auto &reqRepr :
3477- attr->getTrailingWhereClause ()->getRequirements ()) {
3478- if (reqRepr.getKind () == RequirementReprKind::LayoutConstraint) {
3479- if (auto *attributedTy = dyn_cast<AttributedTypeRepr>(reqRepr.getSubjectRepr ())) {
3480- if (attributedTy->has (TypeAttrKind::NoMetadata)) {
3481- const auto resolution = TypeResolution::forInterface (
3482- FD->getDeclContext (), genericSig, std::nullopt ,
3483- /* unboundTyOpener*/ nullptr ,
3484- /* placeholderHandler*/ nullptr ,
3485- /* packElementOpener*/ nullptr );
3486- const auto ty = resolution.resolveType (attributedTy);
3487- typeErasedParams.push_back (ty);
3488- }
3474+ llvm::SmallVector<Type, 4 > typeErasedParams;
3475+ for (const auto &reqRepr :
3476+ attr->getTrailingWhereClause ()->getRequirements ()) {
3477+ if (reqRepr.getKind () == RequirementReprKind::LayoutConstraint) {
3478+ if (auto *attributedTy =
3479+ dyn_cast<AttributedTypeRepr>(reqRepr.getSubjectRepr ())) {
3480+ if (attributedTy->has (TypeAttrKind::NoMetadata)) {
3481+ const auto resolution = TypeResolution::forInterface (
3482+ FD->getDeclContext (), genericSig, std::nullopt ,
3483+ /* unboundTyOpener*/ nullptr ,
3484+ /* placeholderHandler*/ nullptr ,
3485+ /* packElementOpener*/ nullptr );
3486+ const auto ty = resolution.resolveType (attributedTy);
3487+ typeErasedParams.push_back (ty);
34893488 }
34903489 }
34913490 }
3492- attr->setTypeErasedParams (typeErasedParams);
34933491 }
3492+ attr->setTypeErasedParams (typeErasedParams);
34943493
34953494 // Check the target function if there is one.
34963495 attr->getTargetFunctionDecl (FD);
@@ -4885,13 +4884,6 @@ AttributeChecker::visitSPIOnlyAttr(SPIOnlyAttr *attr) {
48854884}
48864885
48874886void AttributeChecker::visitNoMetadataAttr (NoMetadataAttr *attr) {
4888- if (!Ctx.LangOpts .hasFeature (Feature::LayoutPrespecialization)) {
4889- auto error =
4890- diag::experimental_no_metadata_feature_can_only_be_used_when_enabled;
4891- diagnoseAndRemoveAttr (attr, error);
4892- return ;
4893- }
4894-
48954887 if (!isa<GenericTypeParamDecl>(D)) {
48964888 attr->setInvalid ();
48974889 diagnoseAndRemoveAttr (attr, diag::no_metadata_on_non_generic_param);
0 commit comments