Skip to content

BasicFormat fails to add whitespace before effect specifiers #1551

Closed
@stevapple

Description

@stevapple

Description

This happens in function/closure signature/type as well as accessor declarations.

Steps to Reproduce

let functionEffects = FunctionEffectSpecifiersSyntax(asyncSpecifier: .keyword(.async), throwsSpecifier: .keyword(.rethrows))
let typeEffects = TypeEffectSpecifiersSyntax(asyncSpecifier: .keyword(.async), throwsSpecifier: .keyword(.throws))
let accessorEffects = AccessorEffectSpecifiersSyntax(asyncSpecifier: .keyword(.async), throwsSpecifier: .keyword(.throws))

let functionSignature = FunctionSignatureSyntax(input: .init(parameterList: []), effectSpecifiers: functionEffects, output: .init(returnType: TypeSyntax("String")))
let functionType = FunctionTypeSyntax(arguments: [], effectSpecifiers: typeEffects, output: .init(returnType: TypeSyntax("String")))
let closureSignature = ClosureSignatureSyntax(input: .simpleInput([.init(name: "input")]), effectSpecifiers: typeEffects)
let accessorDecl = AccessorDeclSyntax(accessorKind: .keyword(.get), effectSpecifiers: accessorEffects)

print(functionSignature.formatted()) // ()async rethrows -> String
print(functionType.formatted())      // ()async throws -> String
print(closureSignature.formatted())  // inputasync throws in
print(accessorDecl.formatted())      // getasync throws

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions