Skip to content

Get swift-syntax building with Swift 5.5 (again) #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
super.init(viewMode: .all)
}

public static func diagnostics(for tree: SyntaxProtocol) -> [Diagnostic] {
public static func diagnostics<SyntaxType: SyntaxProtocol>(
for tree: SyntaxType
) -> [Diagnostic] {
let diagProducer = ParseDiagnosticsGenerator()
diagProducer.walk(tree)
return diagProducer.diagnostics
Expand Down
18 changes: 10 additions & 8 deletions Tests/SwiftParserTest/RecoveryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,11 @@ public class RecoveryTests: XCTestCase {
var source = """
(first second third struct: Int)
"""
let (_, currentToken) = source.withUTF8 { buffer in
var parser = Parser(buffer)
return (parser.parseFunctionSignature(), parser.currentToken)
}
let (_, currentToken): (RawFunctionSignatureSyntax, Lexer.Lexeme) =
source.withUTF8 { buffer in
var parser = Parser(buffer)
return (parser.parseFunctionSignature(), parser.currentToken)
}

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

XCTAssertEqual(currentToken.tokenKind, .colon)
}
Expand Down