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

Extension imports from 3rd party library detected as "Unused import" #531

Closed
tinder-mhernandez opened this issue Jul 17, 2019 · 2 comments · Fixed by #532
Closed

Extension imports from 3rd party library detected as "Unused import" #531

tinder-mhernandez opened this issue Jul 17, 2019 · 2 comments · Fixed by #532
Milestone

Comments

@tinder-mhernandez
Copy link

tinder-mhernandez commented Jul 17, 2019

I have an Android library module that depends on the toSpannable() extension from Android core-ktx and version 0.34.0 of ktlint is detecting import androidx.core.text.toSpannable as an unused import. When I run the formatter, it removes the import which then cause the code to fail compilation.

Sample Repro:

package com.foo

import android.text.Spannable
import androidx.core.text.toSpannable // <-- Considered as unused

fun foo(text: String): Spannable {
    return text.toSpannable()
}
@tinder-mhernandez
Copy link
Author

No repro on 0.33.0 Only seems to repro on 0.34.0.

@shashachu
Copy link
Contributor

Thanks, Marcelo. This is the second regression reported on this rule in 0.34.0 so I'll take a look but if it's not obvious what's going on, I'll go ahead and revert the changes we made in this release. Sorry for the inconvenience!

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

Successfully merging a pull request may close this issue.

2 participants