-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
paren-spacing does not handle annotated function types without a parameter list #737
Comments
copybara-service bot
pushed a commit
to androidx/androidx
that referenced
this issue
May 7, 2020
-Enables the NonParenthesizedAnnotationsOnFunctionalTypes flag to disable the IDE warning -Temporarily disables the 'paren-spacing' lint in ktlint, due to: pinterest/ktlint#737 -Turns unnecessary parentheses into a 'warning', and stops ignoring this IDE inspection in the UI project Bug: b/155391691 Test: ./gradlew bOS, Studio Change-Id: Ib4af53591b82a0d56ae0733ff2561196c2d49635
goodwinnk
pushed a commit
to JetBrains/kotlin
that referenced
this issue
Mar 14, 2024
-Enables the NonParenthesizedAnnotationsOnFunctionalTypes flag to disable the IDE warning -Temporarily disables the 'paren-spacing' lint in ktlint, due to: pinterest/ktlint#737 -Turns unnecessary parentheses into a 'warning', and stops ignoring this IDE inspection in the UI project Bug: b/155391691 Test: ./gradlew bOS, Studio Change-Id: Ib4af53591b82a0d56ae0733ff2561196c2d49635 [androidx-to-kotlin-move] Original commit: androidx/androidx@3a54b94
goodwinnk
pushed a commit
to JetBrains/kotlin
that referenced
this issue
Mar 20, 2024
-Enables the NonParenthesizedAnnotationsOnFunctionalTypes flag to disable the IDE warning -Temporarily disables the 'paren-spacing' lint in ktlint, due to: pinterest/ktlint#737 -Turns unnecessary parentheses into a 'warning', and stops ignoring this IDE inspection in the UI project Bug: b/155391691 ( https://issuetracker.google.com/issues/155391691 ) Test: ./gradlew bOS, Studio Change-Id: Ib4af53591b82a0d56ae0733ff2561196c2d49635 ( https://android-review.git.corp.google.com/q/Ib4af53591b82a0d56ae0733ff2561196c2d49635 )
goodwinnk
pushed a commit
to JetBrains/kotlin
that referenced
this issue
Mar 21, 2024
-Enables the NonParenthesizedAnnotationsOnFunctionalTypes flag to disable the IDE warning -Temporarily disables the 'paren-spacing' lint in ktlint, due to: pinterest/ktlint#737 -Turns unnecessary parentheses into a 'warning', and stops ignoring this IDE inspection in the UI project Bug: b/155391691 ( https://issuetracker.google.com/issues/155391691 ) Test: ./gradlew bOS, Studio Change-Id: Ib4af53591b82a0d56ae0733ff2561196c2d49635 ( https://android-review.googlesource.com/q/Ib4af53591b82a0d56ae0733ff2561196c2d49635 ) Moved from: androidx/androidx@3a54b94
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given:
(note there is no empty
()
after@Foo
)Expected Behavior
No warning should occur, as the space is required for Kotlin to understand that the
()
is a function type, and not a parameter list for the annotation.Observed Behavior
ktlint will fail with:
...Unexpected spacing before "("
Formatting will remove the space as well, which will cause a compilation error, as:
foo: @Foo() -> Unit
Is not valid Kotlin
Steps to Reproduce
Run ktlint on the code snippet above
Your Environment
Version of ktlint used: 0.36.0 (support for this language feature was only added as a result of Kt-31734, so earlier versions with an older version of the Kotlin embedded compiler crashed when trying to parse this)
The text was updated successfully, but these errors were encountered: