Skip to content

Commit 854189c

Browse files
authored
Merge pull request #994 from ahoppen/ahoppen/remove-throws-annotations
2 parents 397798a + 2236555 commit 854189c

18 files changed

+99
-99
lines changed

Sources/_SwiftSyntaxTestSupport/Syntax+Assertions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public struct SubtreeMatcher {
8080
/// The syntax tree from parsing source *with markers removed*.
8181
private var actualTree: Syntax
8282

83-
public init(_ markedText: String, parse: (String) throws -> Syntax) throws {
83+
public init(_ markedText: String, parse: (String) throws -> Syntax) rethrows {
8484
let (markers, text) = extractMarkers(markedText)
8585

8686
self.markers = markers.isEmpty ? ["DEFAULT": 0] : markers

Tests/PerformanceTest/ParsingPerformanceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ParsingPerformanceTests: XCTestCase {
2222
}
2323
}
2424

25-
func testNativeParsingPerformance() throws {
25+
func testNativeParsingPerformance() {
2626
measure {
2727
do {
2828
let source = try String(contentsOf: inputFile)

Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import SwiftParser
1717

1818
final class DiagnosticsFormatterTests: XCTestCase {
1919

20-
func annotate(source: String) throws -> String {
20+
func annotate(source: String) -> String {
2121
let tree = Parser.parse(source: source)
2222
let diags = ParseDiagnosticsGenerator.diagnostics(for: tree)
2323
return DiagnosticsFormatter.annotatedSource(tree: tree, diags: diags)
2424
}
2525

26-
func testSingleDiagnostic() throws {
26+
func testSingleDiagnostic() {
2727
let source = """
2828
var foo = bar +
2929
"""
@@ -32,10 +32,10 @@ final class DiagnosticsFormatterTests: XCTestCase {
3232
∣ ╰─ expected expression in variable
3333
3434
"""
35-
AssertStringsEqualWithDiff(expectedOutput, try annotate(source: source))
35+
AssertStringsEqualWithDiff(expectedOutput, annotate(source: source))
3636
}
3737

38-
func testMultipleDiagnosticsInOneLine() throws {
38+
func testMultipleDiagnosticsInOneLine() {
3939
let source = """
4040
foo.[].[].[]
4141
"""
@@ -46,10 +46,10 @@ final class DiagnosticsFormatterTests: XCTestCase {
4646
∣ ╰─ expected name in member access
4747
4848
"""
49-
AssertStringsEqualWithDiff(expectedOutput, try annotate(source: source))
49+
AssertStringsEqualWithDiff(expectedOutput, annotate(source: source))
5050
}
5151

52-
func testLineSkipping() throws {
52+
func testLineSkipping() {
5353
let source = """
5454
var i = 1
5555
i = 2

Tests/SwiftOperatorsTest/OperatorTableTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public class OperatorPrecedenceTests: XCTestCase {
187187
XCTAssertNil(foldedExpr.as(SequenceExprSyntax.self))
188188
}
189189

190-
func testParseErrors() throws {
190+
func testParseErrors() {
191191
let sources =
192192
"""
193193
infix operator +
@@ -231,7 +231,7 @@ public class OperatorPrecedenceTests: XCTestCase {
231231
_ = existingGroup
232232
}
233233

234-
func testUnaryErrors() throws {
234+
func testUnaryErrors() {
235235
let sources =
236236
"""
237237
prefix operator +

Tests/SwiftParserTest/Attributes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ final class AttributeTests: XCTestCase {
189189
""")
190190
}
191191

192-
func testImplementsAttribute() throws {
192+
func testImplementsAttribute() {
193193
AssertParse("""
194194
@_implements(P, f0())
195195
func g0() -> Int {
@@ -213,7 +213,7 @@ final class AttributeTests: XCTestCase {
213213
""")
214214
}
215215

216-
func testSemanticsAttribute() throws {
216+
func testSemanticsAttribute() {
217217
AssertParse(
218218
"""
219219
@_semantics("constant_evaluable")

Tests/SwiftParserTest/Availability.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import XCTest
44

55
final class AvailabilityTests: XCTestCase {
6-
func testAvailableMember() throws {
6+
func testAvailableMember() {
77
AssertParse(
88
"""
99
@available(OSX 10.0, introduced: 10.12)
@@ -51,7 +51,7 @@ final class AvailabilityTests: XCTestCase {
5151
)
5252
}
5353

54-
func testAvailabilityMacros() throws {
54+
func testAvailabilityMacros() {
5555
AssertParse(
5656
"""
5757
@available(_iOS9, _macOS10_11, tvOS 11.0, *)
@@ -65,7 +65,7 @@ final class AvailabilityTests: XCTestCase {
6565
""")
6666
}
6767

68-
func testSPIAvailabilityAttribute() throws {
68+
func testSPIAvailabilityAttribute() {
6969
AssertParse(
7070
"""
7171
@_spi_available(*, deprecated, renamed: "another")

Tests/SwiftParserTest/Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ final class DeclarationTests: XCTestCase {
10831083
)
10841084
}
10851085

1086-
func testReasyncFunctions() throws {
1086+
func testReasyncFunctions() {
10871087
AssertParse(
10881088
"""
10891089
class MyType {

Tests/SwiftParserTest/DiagnosticInfrastructureTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SwiftDiagnostics
33
import SwiftParser
44

55
public class DiagnosticInfrastructureTests: XCTestCase {
6-
public func testDiagnosticID() throws {
6+
public func testDiagnosticID() {
77
struct TestDiagnostic: ParserError {
88
let message: String = "My test diagnostic"
99
}

Tests/SwiftParserTest/LexerTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private func lexeme(
1919
}
2020

2121
public class LexerTests: XCTestCase {
22-
func testIdentifiers() throws {
22+
func testIdentifiers() {
2323
var data =
2424
"""
2525
Hello World
@@ -34,7 +34,7 @@ public class LexerTests: XCTestCase {
3434
}
3535
}
3636

37-
func testEscapedIdentifiers() throws {
37+
func testEscapedIdentifiers() {
3838
var data =
3939
"""
4040
`Hello` `World` `$`
@@ -50,7 +50,7 @@ public class LexerTests: XCTestCase {
5050
}
5151
}
5252

53-
func testBlockComments() throws {
53+
func testBlockComments() {
5454
do {
5555
var data =
5656
"""
@@ -89,7 +89,7 @@ public class LexerTests: XCTestCase {
8989
}
9090
}
9191

92-
func testDeepTupleAccess() throws {
92+
func testDeepTupleAccess() {
9393
var data =
9494
#"""
9595
x.1.0
@@ -108,7 +108,7 @@ public class LexerTests: XCTestCase {
108108
}
109109
}
110110

111-
func testUnicodeLiteral() throws {
111+
func testUnicodeLiteral() {
112112
do {
113113
var data =
114114
#"""
@@ -141,7 +141,7 @@ public class LexerTests: XCTestCase {
141141
}
142142

143143

144-
func testNumberLiterals() throws {
144+
func testNumberLiterals() {
145145
var data =
146146
"""
147147
1234567890
@@ -177,7 +177,7 @@ public class LexerTests: XCTestCase {
177177
}
178178
}
179179

180-
func testRawStringLiterals() throws {
180+
func testRawStringLiterals() {
181181
do {
182182
var data =
183183
"""
@@ -237,7 +237,7 @@ public class LexerTests: XCTestCase {
237237
}
238238
}
239239

240-
func testShebang() throws {
240+
func testShebang() {
241241
var data =
242242
"""
243243
#!/usr/bin/swiftc
@@ -255,7 +255,7 @@ public class LexerTests: XCTestCase {
255255
}
256256
}
257257

258-
func testDocComment() throws {
258+
func testDocComment() {
259259
var data =
260260
"""
261261
/** hello */
@@ -274,7 +274,7 @@ public class LexerTests: XCTestCase {
274274
}
275275
}
276276

277-
func testMain() throws {
277+
func testMain() {
278278
var data =
279279
"""
280280
/* TestApp */
@@ -309,7 +309,7 @@ public class LexerTests: XCTestCase {
309309
}
310310
}
311311

312-
func testRegexLexing() throws {
312+
func testRegexLexing() {
313313
let fixtures: [(String, [Lexer.Lexeme])] = [
314314
("/abc/", [
315315
lexeme(.regexLiteral, "/abc/"),

Tests/SwiftParserTest/SyntaxTransformVisitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftParser
1010
import SwiftSyntax
1111

1212
final class SyntaxTransformVisitorTest: XCTestCase {
13-
public func testFunctionCounter() throws {
13+
public func testFunctionCounter() {
1414
struct FuncCounter: SyntaxTransformVisitor {
1515
public func visitAny(_ node: Syntax) -> Int {
1616
visitChildren(node).reduce(0, +)
@@ -38,7 +38,7 @@ final class SyntaxTransformVisitorTest: XCTestCase {
3838
}()
3939
}
4040

41-
public func testPrintFunctionType() throws {
41+
public func testPrintFunctionType() {
4242
/// Assuming there is a single functioned declaration in the source file, print the type of that function.
4343
struct PrintFunctionType: SyntaxTransformVisitor {
4444
func visitAny(_ node: SwiftSyntax.Syntax) -> String {

Tests/SwiftParserTest/TriviaParserTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44

55
final class TriviaParserTests: XCTestCase {
66

7-
func testTriviaParsing() throws {
7+
func testTriviaParsing() {
88

99
XCTAssertEqual(
1010
TriviaParser.parseTrivia("""
@@ -126,7 +126,7 @@ final class TriviaParserTests: XCTestCase {
126126
])
127127
}
128128

129-
func testRawSyntaxLazyTriviaPieces() throws {
129+
func testRawSyntaxLazyTriviaPieces() {
130130
withParser(source: """
131131
/// Foo.
132132
func foo() {
@@ -153,7 +153,7 @@ final class TriviaParserTests: XCTestCase {
153153

154154
}
155155

156-
func testSyntaxLazyTrivia() throws {
156+
func testSyntaxLazyTrivia() {
157157
let source = """
158158
/* comment only */
159159
@@ -165,7 +165,7 @@ final class TriviaParserTests: XCTestCase {
165165
])
166166
}
167167

168-
func testUnexpectedSplitting() throws {
168+
func testUnexpectedSplitting() {
169169
XCTAssertEqual(
170170
TriviaParser.parseTrivia("\u{fffe} ", position: .trailing),
171171
[

0 commit comments

Comments
 (0)