Skip to content

swift-format still can't treat unsafe expressions correctly in some cases #977

Closed
@kkebo

Description

@kkebo

Thanks for fixing #972. However, it seems that swift-format still can't treat unsafe expressions correctly in some cases. The cases are when a l-value is unsafe.

Input

let ptr: UnsafePointer<UInt8>?
// comment
unsafe ptr = .init(bitPattern: 0)
print(ptr)

Expected result

let ptr: UnsafePointer<UInt8>?
// comment
unsafe ptr = .init(bitPattern: 0)
print(ptr)

Actual result

let ptr: UnsafePointer<UInt8>?
// comment

// comment
unsafe ptr = .init(bitPattern: 0)
print(ptr)

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions