@@ -2121,17 +2121,10 @@ ResultTypeRequest::evaluate(Evaluator &evaluator, ValueDecl *decl) const {
21212121 if (decl->preconcurrency ())
21222122 options |= TypeResolutionFlags::Preconcurrency;
21232123
2124- // Placeholders are only currently allowed for FuncDecls with bodies, which
2125- // we diagnose in ReturnTypePlaceholderReplacer.
2126- HandlePlaceholderTypeReprFn placeholderOpener;
2127- if (auto *FD = dyn_cast<FuncDecl>(decl)) {
2128- if (FD->hasBody () && !FD->isBodySkipped ())
2129- placeholderOpener = PlaceholderType::get;
2130- }
21312124 auto *const dc = decl->getInnermostDeclContext ();
21322125 return TypeResolution::forInterface (dc, options,
21332126 /* unboundTyOpener*/ nullptr ,
2134- placeholderOpener,
2127+ /* placeholderOpener*/ nullptr ,
21352128 /* packElementOpener*/ nullptr )
21362129 .resolveType (resultTyRepr);
21372130}
@@ -2259,6 +2252,7 @@ static Type validateParameterType(ParamDecl *decl) {
22592252
22602253 TypeResolutionOptions options (std::nullopt );
22612254 OpenUnboundGenericTypeFn unboundTyOpener = nullptr ;
2255+ HandlePlaceholderTypeReprFn placeholderOpener = nullptr ;
22622256 if (isa<AbstractClosureExpr>(dc)) {
22632257 options = TypeResolutionOptions (TypeResolverContext::ClosureExpr);
22642258 options |= TypeResolutionFlags::AllowUnspecifiedTypes;
@@ -2267,8 +2261,9 @@ static Type validateParameterType(ParamDecl *decl) {
22672261 // For now, just return the unbound generic type.
22682262 return unboundTy;
22692263 };
2270- // FIXME: Don't let placeholder types escape type resolution.
2271- // For now, just return the placeholder type.
2264+ // FIXME: Don't let placeholder types escape type resolution. For now, just
2265+ // return the placeholder type, which we open in `inferClosureType`.
2266+ placeholderOpener = PlaceholderType::get;
22722267 } else if (isa<AbstractFunctionDecl>(dc)) {
22732268 options = TypeResolutionOptions (TypeResolverContext::AbstractFunctionDecl);
22742269 } else if (isa<SubscriptDecl>(dc)) {
@@ -2317,14 +2312,6 @@ static Type validateParameterType(ParamDecl *decl) {
23172312 : TypeResolverContext::FunctionInput);
23182313 options |= TypeResolutionFlags::Direct;
23192314
2320- // We allow placeholders in parameter types to improve recovery since if a
2321- // default argument is present we can suggest the inferred type. Avoid doing
2322- // this for protocol requirements though since those can't ever have default
2323- // arguments anyway.
2324- HandlePlaceholderTypeReprFn placeholderOpener;
2325- if (!isa<ProtocolDecl>(dc->getParent ()))
2326- placeholderOpener = PlaceholderType::get;
2327-
23282315 const auto resolution =
23292316 TypeResolution::forInterface (dc, options, unboundTyOpener,
23302317 placeholderOpener,
0 commit comments