Skip to content
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

[SR-12414] Incorrect formatting for @differentiable declaration attribute "wrt" clauses #333

Closed
dan-zheng opened this issue Mar 25, 2020 · 1 comment
Assignees
Labels
bug Something isn't working swift-format

Comments

@dan-zheng
Copy link

Previous ID SR-12414
Radar None
Original Reporter @dan-zheng
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee @allevato
Priority Medium

md5: a715cc15a2ef229f7493a748950b47d6

Issue Description:

In @differentiable attribute wrt clauses, spaces after commas are incorrectly dropped.
@differentiable(wrt: (x, y)) is wrongly formatted as @differentiable(wrt: (x,y)).


Test case:

@differentiable(wrt: (x, y))
func topLevelFunction(_ x: Float, _ y: Float) -> Float { x }

struct Struct: Differentiable {
    @differentiable(wrt: (self, x, y))
    func method(_ x: Float, _ y: Float) -> Float { x }
}

Actual formatting:

$ swift-format test.swift
@differentiable(wrt: (x,y))
func topLevelFunction(_ x: Float, _ y: Float) -> Float { x }

struct Struct: Differentiable {
    @differentiable(wrt: (self,x,y))
    func method(_ x: Float, _ y: Float) -> Float { x }
}

Expected formatting: original code is correct.

@allevato
Copy link
Collaborator

allevato commented Apr 3, 2020

Fixed by #174.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

2 participants