AST: Promote TypedThrows features to the baseline.

This commit is contained in:
Allan Shortlidge
2024-07-08 22:44:20 -07:00
parent 9717961202
commit 731d91f590
3 changed files with 4 additions and 23 deletions

View File

@@ -183,7 +183,7 @@ BASELINE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexi
BASELINE_LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros")
SUPPRESSIBLE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
SUPPRESSIBLE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
BASELINE_LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(OptionalIsolatedParameters, 420, "Optional isolated parameters")
SUPPRESSIBLE_LANGUAGE_FEATURE(Extern, 0, "@_extern")
LANGUAGE_FEATURE(ExpressionMacroDefaultArguments, 422, "Expression macro as caller-side default argument")

View File

@@ -166,19 +166,6 @@ static bool usesFeatureExtensionMacroAttr(Decl *decl) {
return usesFeatureExtensionMacros(decl);
}
static bool usesFeatureTypedThrows(Decl *decl) {
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
return usesTypeMatching(decl, [](Type ty) {
if (auto funcType = ty->getAs<AnyFunctionType>())
return funcType->hasThrownError();
return false;
});
}
return false;
}
static bool usesFeatureOptionalIsolatedParameters(Decl *decl) {
auto *value = dyn_cast<ValueDecl>(decl);
if (!value)

View File

@@ -7,19 +7,13 @@ public enum MyError: Error {
case fail
}
// CHECK: #if compiler(>=5.3) && $TypedThrows
// CHECK-NEXT: public func throwsMyError() throws(Test.MyError)
// CHECK-NEXT: #endif
// CHECK: public func throwsMyError() throws(Test.MyError)
public func throwsMyError() throws(MyError) { }
// CHECK: #if compiler(>=5.3) && $TypedThrows
// CHECK-NEXT: public func takesClosureThrowingMyError(_ closure: () throws(Test.MyError) -> Swift.Void)
// CHECK-NEXT: #endif
// CHECK: public func takesClosureThrowingMyError(_ closure: () throws(Test.MyError) -> Swift.Void)
public func takesClosureThrowingMyError(_ closure: () throws(MyError) -> Void) {}
public struct HasThrowingInit {
// CHECK: #if compiler(>=5.3) && $TypedThrows
// CHECK-NEXT: public init() throws(Test.MyError)
// CHECK-NEXT: #endif
// CHECK: public init() throws(Test.MyError)
public init() throws(MyError) { }
}