Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed May 12, 2022
1 parent 9a04ce2 commit 5cc8baa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,9 @@ public class IndentationRule :
}

private fun adjustExpectedIndentInFrontOfPropertyAccessor(n: ASTNode, ctx: IndentContext) {
// val adj = ctx.clearExitAdj(n.treeParent)
// if (adj != null) {
// expectedIndent += adj
// logger.trace { "$line: ++in_front(${n.treeNext.elementType}) Keep indent at -> $expectedIndent" }
// ctx.exitAdjBy(n.treeNext, adj)
// } else {
expectedIndent++
logger.trace { "$line: ++in_front(${n.treeNext.elementType}) -> $expectedIndent" }
ctx.exitAdjBy(n.treeNext, -1)
// }
}

private fun adjustExpectedIndentInFrontOfSuperTypeList(n: ASTNode, ctx: IndentContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.pinterest.ktlint.test.LintViolation
import com.pinterest.ktlint.test.MULTILINE_STRING_QUOTE
import com.pinterest.ktlint.test.SPACE
import com.pinterest.ktlint.test.TAB
import kotlin.random.Random
import org.ec4j.core.model.PropertyType
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.DisplayName
Expand Down Expand Up @@ -3769,6 +3770,27 @@ internal class IndentationRuleTest {
}
}

val foo = Any() == true &&
Random.nextBoolean().let { boolean ->
!boolean
} == true

@DisplayName("Issue 1321 - Lambda inside complex boolean expression")
@Nested
inner class Issue1321 {
@Test
fun `Issue 1321 - `() {
val code =
"""
val foo = Any() == true &&
Random.nextBoolean().let { boolean ->
!boolean
} == true
""".trimIndent()
indentationRuleAssertThat(code).hasNoLintViolations()
}
}

private companion object {
val INDENT_STYLE_TAB = indentStyleProperty to PropertyType.IndentStyleValue.tab
}
Expand Down

0 comments on commit 5cc8baa

Please sign in to comment.