Skip to content

Adjust for throws-clause refactoring in swift-syntax #70169

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 1 commit into from
Dec 2, 2023
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
4 changes: 2 additions & 2 deletions lib/ASTGen/Sources/ASTGen/Decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ extension ASTGenVisitor {
parameterList: self.generate(functionParameterClause: node.signature.parameterClause),
asyncSpecifierLoc: (node.signature.effectSpecifiers?.asyncSpecifier).bridgedSourceLoc(in: self),
throwsSpecifierLoc: (node.signature.effectSpecifiers?.throwsSpecifier).bridgedSourceLoc(in: self),
thrownType: self.generate(type: node.signature.effectSpecifiers?.thrownError?.type),
thrownType: self.generate(type: node.signature.effectSpecifiers?.thrownError),
returnType: self.generate(type: node.signature.returnClause?.type),
genericWhereClause: self.generate(genericWhereClause: node.genericWhereClause)
)
Expand All @@ -358,7 +358,7 @@ extension ASTGenVisitor {
parameterList: self.generate(functionParameterClause: node.signature.parameterClause),
asyncSpecifierLoc: (node.signature.effectSpecifiers?.asyncSpecifier).bridgedSourceLoc(in: self),
throwsSpecifierLoc: (node.signature.effectSpecifiers?.throwsSpecifier).bridgedSourceLoc(in: self),
thrownType: self.generate(type: node.signature.effectSpecifiers?.thrownError?.type),
thrownType: self.generate(type: node.signature.effectSpecifiers?.thrownError),
genericWhereClause: self.generate(genericWhereClause: node.genericWhereClause)
)

Expand Down
8 changes: 7 additions & 1 deletion lib/ASTGen/Sources/ASTGen/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import BasicBridging
import SwiftDiagnostics
@_spi(ExperimentalLanguageFeatures) import SwiftSyntax

extension EffectSpecifiersSyntax {
var thrownError: TypeSyntax? {
throwsClause?.type
}
}

/// Check if an `TypeSyntax` can be generated using ASTGen.
///
/// If all the type nodes that shares the first token are migrated,
Expand Down Expand Up @@ -278,7 +284,7 @@ extension ASTGenVisitor {
),
asyncLoc: (node.effectSpecifiers?.asyncSpecifier).bridgedSourceLoc(in: self),
throwsLoc: (node.effectSpecifiers?.throwsSpecifier).bridgedSourceLoc(in: self),
thrownType: self.generate(type: node.effectSpecifiers?.thrownError?.type),
thrownType: self.generate(type: node.effectSpecifiers?.thrownError),
arrowLoc: node.returnClause.arrow.bridgedSourceLoc(in: self),
resultType: generate(type: node.returnClause.type)
)
Expand Down