Skip to content
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

Experimental type-parameter-list-spacing does not support parameterized typealiases #1435

Closed
sam-step opened this issue Mar 22, 2022 · 0 comments · Fixed by #1450
Closed

Comments

@sam-step
Copy link

Expected Behavior

The following parametrized typealias should not fail lint checks:

typealias MySupplier<T> = () -> T

Observed Behavior

Ktlint expects a space before the <

./ktlint MySupplier.kt --experimental
MySupplier.kt:1:21: Expected a single space (experimental:type-parameter-list-spacing)

Autoformatting will apply the space:

// after ./ktlint -F MySupplier.kt --experimental
typealias MySupplier <T> = () -> T

but running check on the above results (as expected) in another failure:

MySupplier.kt:1:21: Unexpected spacing before "<" (experimental:spacing-around-angle-brackets)

interestingly running format a second time on the formatted file results in a failure:

./ktlint -F MySupplier.kt --experimental
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/[...]/ktlint) to field java.lang.Throwable.backtrace
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Steps to Reproduce

Described above.

Your Environment

  • Version of ktlint used: 0.45.1
  • Relevant parts of the .editorconfig settings: n/a
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): used standalone CLI
  • Version of Gradle used (if applicable): n/a
  • Operating System and version: MacOS Big Sur
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants