@@ -3586,34 +3586,6 @@ bool ExprAvailabilityWalker::diagnoseDeclRefAvailability(
35863586static bool
35873587diagnoseDeclAsyncAvailability (const ValueDecl *D, SourceRange R,
35883588 const Expr *call, const ExportContext &Where) {
3589- // FIXME: I don't think this is right, but I don't understand the issue well
3590- // enough to fix it properly. If the decl context is an abstract
3591- // closure, we need it to have a type assigned to it before we can
3592- // determine whether it is an asynchronous context. It will crash
3593- // when we go to check without one. In TypeChecker::typeCheckExpression
3594- // (TypeCheckConstraints.cpp:403), we apply a solution before calling
3595- // `performSyntacticDiagnosticsForTarget`, which eventually calls
3596- // down to this function. Under most circumstances, the context that
3597- // we're in is typechecked at that point and has a type assigned.
3598- // When working with specific result builders, the solution applied
3599- // results in an expression with an unset type. In these cases, the
3600- // application makes its way into `ConstraintSystem::applySolution` for
3601- // closures (CSClosure.cpp:1356). The type is computed, but is
3602- // squirreled away in the constrain system to be applied once the
3603- // checks (including this one) approve of the decls within the decl
3604- // context before applying the type to the expression. It might be
3605- // possible to drive the constraint solver through the availability
3606- // checker and into us so that we can ask for it, but that feels wrong
3607- // too.
3608- // This behavior is demonstrated by the first use of the `tuplify`
3609- // function in `testExistingPatternsInCaseStatements` in
3610- // `test/Constraints/result_builder.swift`.
3611- const AbstractClosureExpr *declCtxAsExpr =
3612- dyn_cast<AbstractClosureExpr>(Where.getDeclContext ());
3613- if (declCtxAsExpr && !declCtxAsExpr->getType ()) {
3614- return false ;
3615- }
3616-
36173589 // If we are in a synchronous context, don't check it
36183590 if (!Where.getDeclContext ()->isAsyncContext ())
36193591 return false ;
0 commit comments