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

Error when formatting unary operators #220

Open
giuseppebertolini opened this issue Apr 24, 2020 · 4 comments
Open

Error when formatting unary operators #220

giuseppebertolini opened this issue Apr 24, 2020 · 4 comments

Comments

@giuseppebertolini
Copy link

it separates minuses and pluses from the number/variable following them which introduces errors.
ex "-1" -> "- 1"

@Jintin
Copy link
Owner

Jintin commented Apr 24, 2020

It shouldn't, can you give me more code sample when the issue happened?

@giuseppebertolini
Copy link
Author

Thanks for replying quickly! It happened to me when using the ternary operator "?:"
the code would go from this: x ? -1 : 1 to x ? - 1: 1. It may help you knowing that this: x ? 1 : -1 would be formatted as x ? 1: -1, which is still correct.
Have a good day!

@Jintin
Copy link
Owner

Jintin commented May 2, 2020

It should work, may I ask your app version?

Jintin added a commit that referenced this issue May 2, 2020
@OolonColoophid
Copy link

Hi

This issue appears to be happening for me. Xcode Version 12.5 (12E262), Swimat Version 1.7.0 (21), macOS 11.3.

This code:

      shapeRect = NSInsetRect(
                    shapeRect,
                    CGFloat(
                        -(borderThickness - 1.0)),
                    CGFloat(
                        -(borderThickness - 1.0)))

Is changed to:

      shapeRect = NSInsetRect(
                    shapeRect,
                    CGFloat(
                        - (borderThickness - 1.0)),
                    CGFloat(
                        - (borderThickness - 1.0)))

The error from Xcode is "Unary operator cannot be separated from its operand".

Cheers

Ian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants