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

nimpretty gives invalid indentation to array elements #9505

Closed
timotheecour opened this issue Oct 25, 2018 · 0 comments

Comments

@timotheecour
Copy link
Contributor

commented Oct 25, 2018

import std/[
    strutils, ospaths, os
]
import pkg/[
  regex
]

proc fun() =
  let a = [
    1,
    2,
  ]
  discard

nimpretty output results in invalid code (doesn't compile anymore):

import std/[
    strutils, ospaths, os
]
import pkg/[
  regex
]

proc fun() =
    let a = [
    1,
    2,
  ]
    discard

note

/cc @Araq one way to avoid this entire class of error (invalid code produced by nimpretty when input code was valid) could be to specify in the nimpretty regression test whether input code was valid in the first place; and if it was, ensure that nimpretty output still compiles ; this would complement the newly introduced test that checks for idempotence

@Araq Araq closed this in 667af87 Jun 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.