Skip to content

Commit 731d91f

Browse files
committed
AST: Promote TypedThrows features to the baseline.
1 parent 9717961 commit 731d91f

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ BASELINE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexi
183183
BASELINE_LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros")
184184
SUPPRESSIBLE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
185185
SUPPRESSIBLE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
186-
LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
186+
BASELINE_LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
187187
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(OptionalIsolatedParameters, 420, "Optional isolated parameters")
188188
SUPPRESSIBLE_LANGUAGE_FEATURE(Extern, 0, "@_extern")
189189
LANGUAGE_FEATURE(ExpressionMacroDefaultArguments, 422, "Expression macro as caller-side default argument")

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,6 @@ static bool usesFeatureExtensionMacroAttr(Decl *decl) {
166166
return usesFeatureExtensionMacros(decl);
167167
}
168168

169-
static bool usesFeatureTypedThrows(Decl *decl) {
170-
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
171-
return usesTypeMatching(decl, [](Type ty) {
172-
if (auto funcType = ty->getAs<AnyFunctionType>())
173-
return funcType->hasThrownError();
174-
175-
return false;
176-
});
177-
}
178-
179-
return false;
180-
}
181-
182169
static bool usesFeatureOptionalIsolatedParameters(Decl *decl) {
183170
auto *value = dyn_cast<ValueDecl>(decl);
184171
if (!value)

test/ModuleInterface/typed_throws.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ public enum MyError: Error {
77
case fail
88
}
99

10-
// CHECK: #if compiler(>=5.3) && $TypedThrows
11-
// CHECK-NEXT: public func throwsMyError() throws(Test.MyError)
12-
// CHECK-NEXT: #endif
10+
// CHECK: public func throwsMyError() throws(Test.MyError)
1311
public func throwsMyError() throws(MyError) { }
1412

15-
// CHECK: #if compiler(>=5.3) && $TypedThrows
16-
// CHECK-NEXT: public func takesClosureThrowingMyError(_ closure: () throws(Test.MyError) -> Swift.Void)
17-
// CHECK-NEXT: #endif
13+
// CHECK: public func takesClosureThrowingMyError(_ closure: () throws(Test.MyError) -> Swift.Void)
1814
public func takesClosureThrowingMyError(_ closure: () throws(MyError) -> Void) {}
1915

2016
public struct HasThrowingInit {
21-
// CHECK: #if compiler(>=5.3) && $TypedThrows
22-
// CHECK-NEXT: public init() throws(Test.MyError)
23-
// CHECK-NEXT: #endif
17+
// CHECK: public init() throws(Test.MyError)
2418
public init() throws(MyError) { }
2519
}

0 commit comments

Comments
 (0)