[FIR] Don't remove subsumed members from intersection overrides's overriddens

This fixes a bunch of missing overridden symbols in IR.
This is also required for fixing KT-59921 in the following commit
where we need to keep all overridden symbols of intersection overrides
so that we can enhance them properly.

#KT-57300 Fixed
#KT-57299 Fixed
#KT-59921
#KT-57300
#KT-62788
#KT-64271
#KT-64382
This commit is contained in:
Kirill Rakhman
2024-01-17 09:59:17 +01:00
committed by Space Team
parent d80dee6e1c
commit 3b841dcb98
58 changed files with 899 additions and 530 deletions
@@ -0,0 +1,41 @@
// FIR_IDENTICAL
// FILE: test.kt
// We inherit getReturnType
// from CallableDescriptor with return type String? and
// from ClassConstructorDescriptorImpl with return type String
// but because ClassConstructorDescriptorImpl.getReturnType subsumes CallableDescriptor.getReturnType, we don't report RETURN_TYPE_MISMATCH_ON_INHERITANCE.
class DeserializedClassConstructorDescriptor : CallableDescriptor, ClassConstructorDescriptorImpl()
// FILE: ClassConstructorDescriptorImpl.java
// IJ reports an inspection warning
// "Non-annotated method 'getReturnType' from 'FunctionDescriptorImpl' implements non-null method from 'ConstructorDescriptor'"
// which is the underlying issue.
public class ClassConstructorDescriptorImpl extends FunctionDescriptorImpl implements ConstructorDescriptor {}
// FILE: FunctionDescriptorImpl.java
public abstract class FunctionDescriptorImpl implements CallableDescriptor {
@Override
public String getReturnType() {
return null;
}
}
// FILE: ConstructorDescriptor.java
import org.jetbrains.annotations.NotNull;
public interface ConstructorDescriptor extends CallableDescriptor {
@NotNull
@Override
String getReturnType();
}
// FILE: CallableDescriptor.java
import org.jetbrains.annotations.Nullable;
public interface CallableDescriptor {
@Nullable
String getReturnType();
}