-
Notifications
You must be signed in to change notification settings - Fork 507
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
Unused import issue with 38.1 #902
Comments
found one more! :) could be related to #886 |
Another reproducer: package com.zak.result
import com.zak.result.Result.Expected
import com.zak.result.Result.Unexpected
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
class ResultTest {
@Test
fun `invoke of any should be expected`() {
assertThat(Result.invoke { 1 }).isEqualTo(Expected(1))
}
@Test
fun `invoke of exception should be unexpected`() {
val ex = Exception()
assertThat(Result.invoke { throw ex }).isEqualTo(Unexpected(ex))
}
@Test
fun `just`() {
assertThat(Result.just(5)).isEqualTo(Result.Expected(5))
}
@Test
fun `raise`() {
val exception = Exception("test")
assertThat(Result.raise(exception)).isEqualTo(Result.Unexpected(exception))
}
} |
I think this is a separate from #886 issue as in this case 'no-unused-imports' rule is failing. Interestingly I could not reproduce it from |
I think first example has been resolved by #889. Minimalized second example: import com.zak.result.Result.Expected
import com.zak.result.Result.Unexpected
import org.assertj.core.api.Assertions.assertThat
fun test() {
assertThat(Result.just(1)).isEqualTo(Expected(1))
assertThat(Result.just(1)).isEqualTo(Result.Expected(1))
val ex = Exception()
assertThat(Result.raise(exception)).isEqualTo(Unexpected(ex))
assertThat(Result.raise(exception)).isEqualTo(Result.Unexpected(exception))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
I expect the following to pass formatting.
Observed Behavior
Fails with:
Unused import (no-unused-imports)
If I remove the
someFunction()
, or define it like so:Steps to Reproduce
run ktlint over the above file ^^
Your Environment
0.38.1
(command line)4.0.1
with AGP3.6
10.15.6
The text was updated successfully, but these errors were encountered: