From e0b4d034bcaa4dadb713ec8d7ee0fc33dcf29522 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 9 Jul 2019 10:08:23 +0200 Subject: [PATCH] nimpretty: yet another improvement (cherry picked from commit 0193c8ad2e01140fe86891f90b49a0292b480d2d) --- compiler/layouter.nim | 2 +- nimpretty/tests/exhaustive.nim | 10 ++++++++++ nimpretty/tests/expected/exhaustive.nim | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/layouter.nim b/compiler/layouter.nim index 0c5ed5fa27..327cba2deb 100644 --- a/compiler/layouter.nim +++ b/compiler/layouter.nim @@ -302,7 +302,7 @@ template rememberSplit(kind) = proc emitMultilineComment(em: var Emitter, lit: string, col: int) = # re-align every line in the multi-line comment: var i = 0 - var lastIndent = em.indentStack[^1] + var lastIndent = if em.keepIndents > 0: em.indentLevel else: em.indentStack[^1] var b = 0 var dontIndent = false for commentLine in splitLines(lit): diff --git a/nimpretty/tests/exhaustive.nim b/nimpretty/tests/exhaustive.nim index 11beedc277..057062fa00 100644 --- a/nimpretty/tests/exhaustive.nim +++ b/nimpretty/tests/exhaustive.nim @@ -731,3 +731,13 @@ type if true: # just one space before comment echo 7 + +# colors.nim:18 +proc `==` *(a, b: Color): bool + ## Compares two colors. + ## + +# colors.nim:18 +proc `==` *(a, b: Color): bool {.borrow.} + ## Compares two colors. + ## diff --git a/nimpretty/tests/expected/exhaustive.nim b/nimpretty/tests/expected/exhaustive.nim index a549a5d6b7..dc0bb75689 100644 --- a/nimpretty/tests/expected/exhaustive.nim +++ b/nimpretty/tests/expected/exhaustive.nim @@ -739,3 +739,13 @@ type if true: # just one space before comment echo 7 + +# colors.nim:18 +proc `==` *(a, b: Color): bool + ## Compares two colors. + ## + +# colors.nim:18 +proc `==` *(a, b: Color): bool {.borrow.} + ## Compares two colors. + ##