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

CastToNullableType: highlights too much #5346

Closed
TWiStErRob opened this issue Sep 24, 2022 · 0 comments · Fixed by #5350
Closed

CastToNullableType: highlights too much #5346

TWiStErRob opened this issue Sep 24, 2022 · 0 comments · Fixed by #5350
Labels
Milestone

Comments

@TWiStErRob
Copy link
Member

Expected Behavior

Highlight either the as keyword or the nullable type, maybe even just the question-mark.

Observed Behavior

Whole expression on the left of the cast is highlighted.
image

Steps to Reproduce

Any expression really, but it shows most when the casted thing is a chain of functional code

listOf("fieldName").map {
	// very long code
	String::class.java.getDeclaredField(it).get(null)
}.first() as String?

Context

Pretty much the same as #5316, but a different rule.

Your Environment

  • Version of detekt used: 1.21.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants