FIR: add test for KT-50969

This commit is contained in:
Mikhail Glukhikh
2022-01-26 15:48:34 +03:00
committed by TeamCityServer
parent 37c6b1c2dc
commit 1137e61fc8
6 changed files with 96 additions and 0 deletions
@@ -0,0 +1,28 @@
FILE: Impl.kt
public abstract class Impl : R|Base| {
public constructor(): R|Impl| {
super<R|kotlin/Any|>()
}
public open override fun foo(name: R|kotlin/String|): R|Base| {
^foo this@R|/Impl|
}
}
FILE: test.kt
public abstract class ImplDerived : R|Impl|, R|Derived| {
public constructor(): R|ImplDerived| {
super<R|Impl|>()
}
public abstract override fun foo(name: R|kotlin/String?|): R|Derived|
}
public abstract class DerivedImpl : R|Derived|, R|Impl| {
public constructor(): R|DerivedImpl| {
super<R|Impl|>()
}
public abstract override fun foo(name: R|kotlin/String?|): R|Derived|
}
@@ -0,0 +1,36 @@
// SCOPE_DUMP: ImplDerived:foo, DerivedImpl:foo
// FILE: Base.java
import org.jetbrains.annotations.NotNull;
public interface Base {
Base foo(@NotNull String name);
}
// FILE: Derived.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface Derived extends Base {
@Override
@NotNull Derived foo(@Nullable String name);
}
// FILE: Impl.kt
abstract class Impl : Base {
override fun foo(name: String): Base {
return this
}
}
// FILE: test.kt
abstract <!RETURN_TYPE_MISMATCH_ON_INHERITANCE!>class ImplDerived<!> : Impl(), Derived {
abstract <!NOTHING_TO_OVERRIDE!>override<!> fun foo(name: String?): Derived
}
abstract class DerivedImpl : Derived, Impl() {
abstract override fun foo(name: String?): Derived
}
@@ -0,0 +1,14 @@
ImplDerived:
[Source]: public abstract override fun foo(name: R|kotlin/String?|): R|Derived| from Use site scope of /ImplDerived [id: 0]
[IntersectionOverride]: public open fun foo(name: R|ft<kotlin/String, kotlin/String?>|): R|@EnhancedNullability Derived| from Use site scope of /ImplDerived [id: 0]
[Source]: public open override fun foo(name: R|kotlin/String|): R|Base| from Use site scope of /Impl [id: 1]
[Enhancement]: public abstract fun foo(name: R|@EnhancedNullability kotlin/String|): R|ft<Base, Base?>| from Java enhancement scope for /Base [id: 2]
[Enhancement]: public abstract fun foo(name: R|ft<kotlin/String, kotlin/String?>|): R|@EnhancedNullability Derived| from Java enhancement scope for /Derived [id: 3]
[Enhancement]: public abstract fun foo(name: R|@EnhancedNullability kotlin/String|): R|ft<Base, Base?>| from Java enhancement scope for /Base [id: 2]
DerivedImpl:
[Source]: public abstract override fun foo(name: R|kotlin/String?|): R|Derived| from Use site scope of /DerivedImpl [id: 0]
[Enhancement]: public abstract fun foo(name: R|ft<kotlin/String, kotlin/String?>|): R|@EnhancedNullability Derived| from Java enhancement scope for /Derived [id: 1]
[Enhancement]: public abstract fun foo(name: R|@EnhancedNullability kotlin/String|): R|ft<Base, Base?>| from Java enhancement scope for /Base [id: 2]
[Source]: public open override fun foo(name: R|kotlin/String|): R|Base| from Use site scope of /Impl [id: 3]
[Enhancement]: public abstract fun foo(name: R|@EnhancedNullability kotlin/String|): R|ft<Base, Base?>| from Java enhancement scope for /Base [id: 2]