@@ -3720,11 +3720,6 @@ NeverNullType TypeResolver::resolveASTFunctionType(
3720
3720
Type thrownTy;
3721
3721
if (auto thrownTypeRepr = repr->getThrownTypeRepr ()) {
3722
3722
ASTContext &ctx = getASTContext ();
3723
- if (!ctx.LangOpts .hasFeature (Feature::TypedThrows)) {
3724
- diagnoseInvalid (
3725
- thrownTypeRepr, thrownTypeRepr->getLoc (), diag::experimental_typed_throws);
3726
- }
3727
-
3728
3723
auto thrownTypeOptions = options.withoutContext ();
3729
3724
thrownTy = resolveType (thrownTypeRepr, thrownTypeOptions);
3730
3725
if (thrownTy->hasError ()) {
@@ -5694,10 +5689,6 @@ Type ExplicitCaughtTypeRequest::evaluate(
5694
5689
}
5695
5690
5696
5691
// We have an explicit thrown error type, so resolve it.
5697
- if (!ctx.LangOpts .hasFeature (Feature::TypedThrows)) {
5698
- ctx.Diags .diagnose (thrownTypeRepr->getLoc (), diag::experimental_typed_throws);
5699
- }
5700
-
5701
5692
auto options = TypeResolutionOptions (TypeResolverContext::None);
5702
5693
if (func->preconcurrency ())
5703
5694
options |= TypeResolutionFlags::Preconcurrency;
@@ -5713,11 +5704,6 @@ Type ExplicitCaughtTypeRequest::evaluate(
5713
5704
if (auto closure = catchNode.dyn_cast <ClosureExpr *>()) {
5714
5705
// Explicit thrown error type.
5715
5706
if (auto thrownTypeRepr = closure->getExplicitThrownTypeRepr ()) {
5716
- if (!ctx.LangOpts .hasFeature (Feature::TypedThrows)) {
5717
- ctx.Diags .diagnose (thrownTypeRepr->getLoc (),
5718
- diag::experimental_typed_throws);
5719
- }
5720
-
5721
5707
return TypeResolution::resolveContextualType (
5722
5708
thrownTypeRepr, closure,
5723
5709
TypeResolutionOptions (TypeResolverContext::None),
@@ -5739,18 +5725,9 @@ Type ExplicitCaughtTypeRequest::evaluate(
5739
5725
// A do..catch block with no explicit 'throws' annotation will infer
5740
5726
// the thrown error type.
5741
5727
if (doCatch->getThrowsLoc ().isInvalid ()) {
5742
- // Prior to typed throws, the do..catch always throws 'any Error'.
5743
- if (!ctx.LangOpts .hasFeature (Feature::TypedThrows))
5744
- return ctx.getErrorExistentialType ();
5745
-
5746
5728
return Type ();
5747
5729
}
5748
5730
5749
- if (!ctx.LangOpts .hasFeature (Feature::TypedThrows)) {
5750
- ctx.Diags .diagnose (doCatch->getThrowsLoc (), diag::experimental_typed_throws);
5751
- return ctx.getErrorExistentialType ();
5752
- }
5753
-
5754
5731
auto typeRepr = doCatch->getCaughtTypeRepr ();
5755
5732
5756
5733
// If there is no explicitly-specified thrown error type, it's 'any Error'.
0 commit comments