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
As a contrived example, but trimmed down from a real example, consider the file Foo.kt:
class Foo() {
constructor(name: String) : this() {
}
}
This should pass lint checks with no warnings.
Observed Behavior
ktlint reports a warning:
Foo.kt:1:10: No parenthesis expected (standard:class-signature)
12:30:54.868 [main] WARN com.pinterest.ktlint.cli.internal.KtlintCommandLine -- Lint has found errors than can be autocorrected using 'ktlint --format'
Summary error count (descending) by rule:
standard:class-signature: 1
And if --format is enabled automatically removes the primary constructor for Foo:
class Foo {
however that constructor is actually being used by the other constructor, causing the following compilation error:
tmp/Foo.kt:8:13: error: supertype initialization is impossible without primary constructor
class Foo {
^
tmp/Foo.kt:9:37: error: no value passed for parameter 'name'
constructor(name: String) : this() {
^Target //tmp:FooLib failed to build
Your Environment
Version of ktlint used: 1.3.0 (as provided by bazel rules_kotlin)
No .editorconfig settings
Name and version (or code for custom task) of integration used (bazel 7.2.1 with rules_kotlin 1.9.6):
Operating System and version: Linux vm-shared 6.5.0-1016-gcp #16~22.04.1-Ubuntu SMP Sat Mar 9 00:58:37 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
Expected Behavior
As a contrived example, but trimmed down from a real example, consider the file Foo.kt:
This should pass lint checks with no warnings.
Observed Behavior
ktlint reports a warning:
And if
--format
is enabled automatically removes the primary constructor for Foo:however that constructor is actually being used by the other constructor, causing the following compilation error:
Your Environment
.editorconfig
settingsLinux vm-shared 6.5.0-1016-gcp #16~22.04.1-Ubuntu SMP Sat Mar 9 00:58:37 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: