You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ArgumentListWrappingRule().format(
"""
package com.foo
class MyClass() {
private fun doSomething() {
if (d == 0 || e == 0f) {
c.ee(hh, d, d, yy)
} else {
foo.blah()
val dr = t - u
val xx = -gg(dr) * rr(2f * d, dr.hh)
foo.bar(
dd,
g - d
)
foo.baz(
a.b, a.c - d
)
foo.biz(
a.b, a.c - d,
a.b, a.c,
a.b + d, a.c
)
foo.baz(
a.x - d, a.c
)
foo.biz(
a.x - d, a.c,
a.x, a.c,
a.x, a.c - d
)
foo.baz(
a.x, a.j + d
)
}
}
}
""".trimIndent()
Caused by: java.lang.IndexOutOfBoundsException: Wrong offset: 839. Should be in range: [0, 773]
at org.jetbrains.kotlin.com.intellij.openapi.editor.impl.LineSet.findLineIndex(LineSet.java:178)
at org.jetbrains.kotlin.com.intellij.openapi.editor.impl.DocumentImpl.getLineNumber(DocumentImpl.java:991)
at com.pinterest.ktlint.core.ast.PackageKt.lineNumber(package.kt:236)
at com.pinterest.ktlint.ruleset.experimental.ArgumentListWrappingRule.isOnSameLineAsIfKeyword(ArgumentListWrappingRule.kt:225)
at com.pinterest.ktlint.ruleset.experimental.ArgumentListWrappingRule.visit(ArgumentListWrappingRule.kt:96)
at com.pinterest.ktlint.core.KtLint$format$1.invoke(KtLint.kt:300)
When you make it much shorter, it does not crash. Perhaps each node's startOffset is not being updated as corrections are made?
Your Environment
Version of ktlint used: 0.40.0
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): CLI
Version of Gradle used (if applicable): 6.6
Operating System and version: Mac OS 10.15.7
The text was updated successfully, but these errors were encountered:
Steps to Reproduce
This test will throw an exception:
When you make it much shorter, it does not crash. Perhaps each node's startOffset is not being updated as corrections are made?
Your Environment
The text was updated successfully, but these errors were encountered: