Skip to content

Commit 6c2eabe

Browse files
authored
Merge pull request swiftlang#648 from DougGregor/no-implicit-open-existentials
2 parents 2cd5873 + 52635d1 commit 6c2eabe

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Sources/SwiftParser/Diagnostics/ParseDiagnosticsGenerator.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
5353
super.init(viewMode: .all)
5454
}
5555

56-
public static func diagnostics(for tree: SyntaxProtocol) -> [Diagnostic] {
56+
public static func diagnostics<SyntaxType: SyntaxProtocol>(
57+
for tree: SyntaxType
58+
) -> [Diagnostic] {
5759
let diagProducer = ParseDiagnosticsGenerator()
5860
diagProducer.walk(tree)
5961
return diagProducer.diagnostics

Tests/SwiftParserTest/RecoveryTests.swift

+10-8
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,11 @@ public class RecoveryTests: XCTestCase {
267267
var source = """
268268
(first second third struct: Int)
269269
"""
270-
let (_, currentToken) = source.withUTF8 { buffer in
271-
var parser = Parser(buffer)
272-
return (parser.parseFunctionSignature(), parser.currentToken)
273-
}
270+
let (_, currentToken): (RawFunctionSignatureSyntax, Lexer.Lexeme) =
271+
source.withUTF8 { buffer in
272+
var parser = Parser(buffer)
273+
return (parser.parseFunctionSignature(), parser.currentToken)
274+
}
274275

275276
// The 'struct' keyword should be taken as an indicator that a new decl
276277
// starts here, so `parseFunctionSignature` shouldn't eat it.
@@ -334,10 +335,11 @@ public class RecoveryTests: XCTestCase {
334335
(first second third
335336
: Int)
336337
"""
337-
let (_, currentToken) = source.withUTF8 { buffer in
338-
var parser = Parser(buffer)
339-
return (parser.parseFunctionSignature(), parser.currentToken)
340-
}
338+
let (_, currentToken): (RawFunctionSignatureSyntax, Lexer.Lexeme) =
339+
source.withUTF8 { buffer in
340+
var parser = Parser(buffer)
341+
return (parser.parseFunctionSignature(), parser.currentToken)
342+
}
341343

342344
XCTAssertEqual(currentToken.tokenKind, .colon)
343345
}

0 commit comments

Comments
 (0)