mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ConvertObjectToDataObjectInspection: fix "!is" case
^KTIJ-24348 Fixed IJ-MR-101834 GitOrigin-RevId: 5ff6a9d8bc664facb0b0d738f779a07854926dd4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f634e1c4d3
commit
965061ee55
+1
-1
@@ -97,7 +97,7 @@ private fun KtExpression.tryUnwrapElvisOrDoubleBang(context: Lazy<BindingContext
|
||||
private fun isCompatibleEquals(ktObject: KtObjectDeclaration, ktObjectFqn: Lazy<FqName>): Boolean =
|
||||
when (val equals = ktObject.findEquals()) {
|
||||
is Function -> ktObjectFqn.value == equals.function.singleExpressionBody()
|
||||
?.asSafely<KtIsExpression>()?.typeReference?.let { typeReference ->
|
||||
?.asSafely<KtIsExpression>()?.takeUnless(KtIsExpression::isNegated)?.typeReference?.let { typeReference ->
|
||||
typeReference.analyze(BodyResolveMode.PARTIAL_NO_ADDITIONAL)[BindingContext.TYPE, typeReference]?.fqName
|
||||
}
|
||||
NonTrivialSuper -> false
|
||||
|
||||
+5
@@ -4015,6 +4015,11 @@ public abstract class LocalInspectionTestGenerated extends AbstractLocalInspecti
|
||||
runTest("testData/inspectionsLocal/convertObjectToDataObject/notCompatibleEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notCompatibleEquals2.kt")
|
||||
public void testNotCompatibleEquals2() throws Exception {
|
||||
runTest("testData/inspectionsLocal/convertObjectToDataObject/notCompatibleEquals2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notCompatibleInheritedEquals.kt")
|
||||
public void testNotCompatibleInheritedEquals() throws Exception {
|
||||
runTest("testData/inspectionsLocal/convertObjectToDataObject/notCompatibleInheritedEquals.kt");
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:+DataObjects
|
||||
// PROBLEM: none
|
||||
object<caret> Foo {
|
||||
override fun toString(): String = "Foo"
|
||||
override fun equals(other: Any?): Boolean = other !is Foo
|
||||
}
|
||||
Reference in New Issue
Block a user