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

Formatting changes semantics of the code when using functions with the expression body written in the next line #1064

Closed
antifriz opened this issue Jan 20, 2021 · 1 comment

Comments

@antifriz
Copy link

Expected Behavior

main.kt:

fun foo()
= 1

should either leave it as it is or indent it accordingly

Observed Behavior

running ktlint -F main.kt edits the file in the following way

fun foo()
1

which changes the semantics of the code / makes it invalid

Steps to Reproduce

printf 'fun foo()\n=1' > /tmp/foo.kt
ktlint -F /tmp/foo.kt
cat /tmp/foo.kt

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): bash-3.2
  • Version of Gradle used (if applicable): n/a
  • Operating System and version: macOS 10.15.6
  • Link to your project (if it's a public repository): n/a
@Tapchicoma
Copy link
Collaborator

Could not reproduce with current snapshot version. Most probably was fixed with #1039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants