05d65275bf
Before this commit we took just first intersection member for this check. However it's quite bad, because we were dependent on supertype order. Choosing the most specific member looks more consistent here. #KT-50969 Fixed
37 lines
733 B
Kotlin
Vendored
37 lines
733 B
Kotlin
Vendored
// 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 class ImplDerived : Impl(), Derived {
|
|
abstract override fun foo(name: String?): Derived
|
|
}
|
|
|
|
abstract class DerivedImpl : Derived, Impl() {
|
|
abstract override fun foo(name: String?): Derived
|
|
}
|