-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Internal Error when upgrading from 0.41.0 to 0.42.1 #1210
Comments
@NikolayMetchev are you able to test with the latest SNAPSHOT? I believe this commit fixes your issues #1203 |
FWIW, the following snippet also triggers an Internal Error in ktlint package com.repro
import kotlin.properties.Delegates
class Repro {
private var repro
by Delegates.vetoable("") { _, old, new ->
true
}
} The error message is:
No issue if I re-format to package com.repro
import kotlin.properties.Delegates
class Repro {
private var repro by Delegates.vetoable("") { _, old, new ->
true
}
} |
@mhernand40 Tnx for your example and observation how reformat made a difference. The stacktrace of the error is as follows:
@t-kameyama Could you please have a look at this? This bug is somewhat related to your commit aa47c9e. Problem is that the RPAR leads to an unwanted decrement of the expectedIndent cause its value to go below zero. |
I attempted to run head against my code but I couldn't. I think it is because we have the following enabled in our build:
Which produces the following error when it tries to build the ktlint project:
|
I found other way to reproduce this issue: object ApplicationComponentFactory : ApplicationComponent.Factory
by DaggerApplicationComponent.factory() Testing with 0.43.1 if I reformat the code like this ktlint is happy and without errors: object ApplicationComponentFactory :
ApplicationComponent.Factory by DaggerApplicationComponent.factory() |
Is there any update on this? Running into the same issue with the latest version 0.43.2 |
@BraisGabin I really love it when somebody has such a short example to reproduce an issue ;-) I could reproduce and solve it. Code sample:
results in following stack trace:
|
Forces the BY keyword in a super type call entry to be indented when preceded by a new line Closes pinterest#1210
* Fix indentation of delegated super type call entry Forces the BY keyword in a super type call entry to be indented when preceded by a new line Closes #1210 * Fix negative indent level after formatting a supertype delegate Co-authored-by: Paul Dingemans <pdingemans@bol.com>
Original fix for pinterest#1210 solved the runtime exception during formatting but also reformatted some delegate by constructs which are conflicting with the default IntelliJ formatting.
After upgrading 2 files cause ktlint to fail with an Internal Error (indent)
SettlementsSpec.kt.zip
generators.kt.zip
Expected Behavior
the file should get formatted
Observed Behavior
SettlementsSpec.kt:0:0: Internal Error (indent). Please create a ticket at https://github.com/pinterest/ktlint/issues (if possible, provide the source code that triggered an error) (cannot be auto-corrected)
Steps to Reproduce
Format the attached file
Your Environment
Gradle Task:
task ktlintFmt(type: JavaExec) {
mainClass.set("com.pinterest.ktlint.Main")
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
onlyIf {
System.env['CI'] == null
}
}
The text was updated successfully, but these errors were encountered: