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

[nimpretty] proc is transfered to incorrect code #8626

Closed
tim-st opened this Issue Aug 13, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@tim-st
Copy link
Contributor

tim-st commented Aug 13, 2018

The correct code

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
  var keyVal: string
  var dataVal: string

is transfered to the incorrect

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
var keyVal: string
    var dataVal: string

The same happens for:

proc test(): string
    {.noSideEffect, raises: [].} =
  ## test
  discard

which results in:

proc test(): string
    {.noSideEffect, raises: [].} =
## test
    discard

@Araq Araq closed this in ed38079 Oct 16, 2018

@tim-st

This comment has been minimized.

Copy link
Contributor

tim-st commented Oct 19, 2018

The fix will put everything on the same level like the indented line is.
I think it is better to let the code below the indented line on the same level like it was before.
At least this was the coding style I wanted in the case of a proc that line breaked.

For example:

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
  var keyVal: string
  var dataVal: string

Should stay when formatted.
Now it becomes

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
    var keyVal: string
    var dataVal: string

narimiran added a commit to narimiran/Nim that referenced this issue Oct 31, 2018

narimiran added a commit to narimiran/Nim that referenced this issue Nov 1, 2018

narimiran added a commit that referenced this issue Nov 1, 2018

narimiran added a commit that referenced this issue Nov 1, 2018

nimpretty: fixes #8626
(cherry picked from commit ed38079)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment