[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,37 @@
interface IBase {
fun copy(): IBase
}
interface ILeft : IBase {
override fun copy(): ILeft
}
open class CLeft : ILeft {
override fun copy(): ILeft = CLeft()
}
interface IRight : IBase {
override fun copy(): IRight
}
interface IDerived : ILeft, IRight {
override fun copy(): IDerived
}
// Error: ILeft::copy and IRight::copy have unrelated return types
class CDerivedInvalid1 : ILeft, IRight
// Error: CLeft::copy and IRight::copy have unrelated return types
class CDerivedInvalid2 : CLeft(), IRight
// OK: CDerived1::copy overrides both ILeft::copy and IRight::copy
class CDerived1 : ILeft, IRight {
override fun copy(): CDerived1 = CDerived1()
}
// Although ILeft::copy and IRight::copy return types are unrelated, IDerived::copy return type is the most specific of three.
abstract class CDerived2 : ILeft, IRight, IDerived
class CDerived2a : ILeft, IRight, IDerived {
override fun copy(): IDerived = CDerived2a()
}
@@ -0,0 +1,27 @@
// FILE: J.java
public interface J {
String foo(); // String!
}
// FILE: K.kt
interface K1 {
fun foo(): String
}
interface K2 {
fun foo(): String?
}
interface KDerived1a : K1, J
interface KDerived1b : J, K1
interface KDerived2a : K2, J
interface KDerived2b : J, K2
interface KDerived12a : K1, K2, J
interface KDerived12b : K1, J, K2
interface KDerived12c : J, K1, K2
@@ -0,0 +1,61 @@
// FILE: InOut.kt
interface In<in T>
// FILE: J1.java
public interface J1 {
In<String> foo();
}
// FILE: J2.java
import org.jetbrains.annotations.*;
public interface J2 {
@NotNull In<String> foo();
}
// FILE: J3.java
import org.jetbrains.annotations.*;
public interface J3 {
@Nullable In<String> foo();
}
// FILE: K.kt
interface K1 {
fun foo(): In<String>
}
interface K2 {
fun foo(): In<String?>
}
// FIXME TestJ1K1 should have foo(): In<String!>, since In<String!> <: In<String>.
interface TestJ1K1 : J1, K1
interface TestK1J1 : K1, J1
interface TestJ1K2 : J1, K2
interface TestK2J1 : K2, J1
interface TestJ2K1 : J2, K1
interface TestK1J2 : K1, J2
interface TestJ2K2 : J2, K2
interface TestK2J2 : K2, J2
interface TestJ3K1 : J3, K1
interface TestK1J3 : K1, J3
interface TestJ3K2 : J3, K2
interface TestK2J3 : K2, J3
interface TestJ1K1K2 : J1, K1, K2
interface TestK1J1K2 : K1, J1, K2
interface TestK1K2J1 : K1, K2, J1
interface TestJ2K1K2 : J2, K1, K2
interface TestK1J2K2 : K1, J2, K2
interface TestK1K2J2 : K1, K2, J2
interface TestJ3K1K2 : J3, K1, K2
interface TestK1J3K2 : K1, J3, K2
interface TestK1K2J3 : K1, K2, J3
@@ -0,0 +1,43 @@
// FILE: J.java
public interface J {
java.util.List<String> foo();
}
// FILE: K.kt
interface ILNS {
fun foo(): List<String?>
}
interface IMLS {
fun foo(): MutableList<String>
}
interface IMLNS {
fun foo(): MutableList<String?>
}
interface ILS {
fun foo(): List<String>
}
interface Test1 : ILNS, J
interface Test2 : J, ILNS
interface Test3 : IMLS, J
interface Test4 : J, IMLS
interface Test5 : ILNS, IMLS, J
interface Test6 : ILNS, J, IMLS
interface Test7 : J, ILNS, IMLS
// Return types of ILS::foo and IMLNS::foo are incompatible themselves.
// However, return type of J::foo is (Mutable)List<String!>!,
// which is subtype of both List<String> and MutalbeList<String?>.
// Thus, inheriting from J, IMLNS, and ILS is Ok,
// but inheriting from IMLNS and ILS is not.
interface Test8 : J, IMLNS, ILS
interface Test9 : IMLNS, J, ILS
interface Test10 : IMLNS, ILS, J
interface Test11 : IMLNS, ILS
@@ -0,0 +1,56 @@
// FILE: JFooWithUpperBound.java
public interface JFooWithUpperBound<T extends IBase> {
T foo();
}
// FILE: JFooWithUpperBoundDerived.java
public interface JFooWithUpperBoundDerived<T extends IBase> extends JFooWithUpperBound<T> {
}
// FILE: JCFooWithUpperBound.java
public class JCFooWithUpperBound<T extends IBase> {
public T foo() {
return null;
}
}
// FILE: JCFooWithUpperBoundDerived.java
public class JCFooWithUpperBoundDerived<T extends IBase> extends JCFooWithUpperBound<T> {
}
// FILE: K.kt
interface IBase
interface IDerived : IBase
interface IFooWithUpperBound<T : IBase> {
fun foo(): T
}
interface IFooT<T> {
fun foo(): T
}
interface IFoo {
fun foo(): IBase
}
interface IFooDerived : IFoo {
override fun foo(): IDerived
}
interface IFooWithUpperBoundDerived<T : IBase> : IFooWithUpperBound<T>
interface Test1<T : IBase> : IFooWithUpperBound<T>, IFoo
interface Test2<T : IBase> : IFooT<T>, IFoo
interface Test3<T : IDerived> : IFooWithUpperBoundDerived<T>, IFooDerived
interface Test4<T : IBase> : JFooWithUpperBound<T>, IFoo
interface Test5<T : IDerived> : JFooWithUpperBoundDerived<T>, IFooDerived
class Test6<T : IBase> : JCFooWithUpperBound<T>(), IFoo
class Test7<T : IDerived> : JCFooWithUpperBoundDerived<T>(), IFooDerived
@@ -0,0 +1,13 @@
interface IFooAny {
val foo: Any
}
interface IFooStr : IFooAny {
override val foo: String
}
abstract class BaseAny(override val foo: Any): IFooAny
abstract class BaseStr : BaseAny(42), IFooStr
class C : BaseStr()
@@ -0,0 +1,47 @@
// FILE: K.kt
abstract class ATest1 : TestNN.JNullVsNotNull()
abstract class ATest2 : TestNN.JUnknownImpl(), TestNN.JNotNull
abstract class ATest3 : TestNN.JUnknownVsNotNull()
class CTest1 : TestNN.JNullVsNotNull()
class CTest2 : TestNN.JUnknownImpl(), TestNN.JNotNull
class CTest3 : TestNN.JUnknownVsNotNull()
// FILE: TestNN.java
import org.jetbrains.annotations.*;
public class TestNN {
public interface JNull {
@Nullable Object foo();
}
public interface JNotNull {
@NotNull Object foo();
}
public static class JNullVsNotNull implements JNull, JNotNull {
public Object foo() {
return this;
}
}
public static class JNullBase {
@Nullable public Object foo() {
return null;
}
}
public static class JUnknownImpl extends JNullBase {
public Object foo() {
return this;
}
}
public static class JUnknownVsNotNull extends JUnknownImpl implements JNotNull {
}
}
@@ -0,0 +1,13 @@
interface A {
fun <T> foo()
fun <T> bar()
}
interface B {
fun foo()
fun bar()
}
interface C1 : A, B {
override fun bar()
}
@@ -0,0 +1,29 @@
open class A {
open fun foo(): Boolean = true
}
interface IA {
fun foo(): String
}
interface IAA {
fun foo(): Int
}
interface IGA<T> {
fun foo(): T
}
class B1: A(), IA
class B2: A(), IA, IAA
abstract class B3: IA, IAA
class BS1: A(), IGA<Boolean>
class BS2: A(), IGA<Any>
class BS3: A(), IGA<String>
class BG1<T>: A(), IGA<T>
@@ -0,0 +1,33 @@
interface IA {
fun method(): String
val propVal: String
var propVar: String
}
interface IB1 : IA
interface IB2 : IA
interface IGA<T> {
fun method(): T
val propVal: T
var propVar: T
}
interface IGB1Str : IGA<String>
interface IGB2Str : IGA<String>
interface IGB3Int : IGA<Int>
interface IGB4T<T> : IGA<T>
interface IGB5T<T> : IGA<T>
interface IC : IB1, IB2
interface IGC1 : IGB1Str, IGB2Str
interface IGC2 : IGB1Str, IGB3Int
interface IGC3<T> : IGB4T<T>, IGB5T<T>
interface IGC4<T> : IGB4T<T>, IGB5T<String>
interface IGC5 : IGB4T<String>, IGB5T<String>
@@ -0,0 +1,29 @@
open class A {
open val foo: Boolean = true
}
interface IA {
val foo: String
}
interface IAA {
val foo: Int
}
interface IGA<T> {
val foo: T
}
class B1: A(), IA
class B2: A(), IA, IAA
abstract class B3: IA, IAA
class BS1: A(), IGA<Boolean>
class BS2: A(), IGA<Any>
class BS3: A(), IGA<String>
class BG1<T>: A(), IGA<T>
@@ -0,0 +1,29 @@
open class A {
open var foo: Boolean = true
}
interface IA {
var foo: String
}
interface IAA {
var foo: Int
}
interface IGA<T> {
var foo: T
}
class B1: A(), IA
class B2: A(), IA, IAA
abstract class B3: IA, IAA
class BS1: A(), IGA<Boolean>
class BS2: A(), IGA<Any>
class BS3: A(), IGA<String>
class BG1<T>: A(), IGA<T>