[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,38 @@
package override
interface T {
fun foo()
val v : Int
}
open class Br(t : T) : T {
}
class Br3(t : T) : Br(t) {
}
open class Br1(t : T) : T by t {
}
class Br2(t : T) : Br1(t) {
}
interface G<T> {
fun foo(t : T) : T
}
class GC() : G<Int> {
}
open class GC1(g : G<Int>) : G<Int> by g {
}
open class GC2(g : G<Int>) : GC1(g) {
}
@@ -0,0 +1,26 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A<T> {
fun foo(): Int
}
class AImpl<T>: A<T> {
override fun foo() = 42
}
class B : A<Int> by AImpl()
fun <T> bar(): A<T> = AImpl()
class C : A<Int> by bar()
fun <T> baz(f: (T) -> T): A<T> = AImpl()
class D : A<Int> by baz({ it + 1 })
fun <T> boo(t: T): A<T> = AImpl()
class E : A<Int> by boo("")
class F : A<Int> by AImpl<String>()
@@ -0,0 +1,15 @@
open class Foo() {
}
class Barrr() : Foo by Foo() {}
interface T {}
class Br(t : T) : T by t {}
open enum class EN() {
A
}
class Test2(e : EN) : EN by e {}
@@ -0,0 +1,4 @@
// JAVAC_EXPECTED_FILE
class TestIface(r : Runnable) : Runnable by r {}
class TestObject(o : Object) : Object by o {}
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
interface One {
public fun foo(): Any?
}
interface Two {
public fun foo(): String?
}
interface Three {
public fun foo(): String
}
class Test123(val v1: One, val v2: Two, val v3: Three) : One by v1, Two by v2, Three by v3 { }
class Test132(val v1: One, val v2: Two, val v3: Three) : One by v1, Three by v3, Two by v2 { }
class Test312(val v1: One, val v2: Two, val v3: Three) : Three by v3, One by v1, Two by v2 { }
class Test321(val v1: One, val v2: Two, val v3: Three) : Three by v3, Two by v2, One by v1 { }
class Test231(val v1: One, val v2: Two, val v3: Three) : Two by v2, Three by v3, One by v1 { }
class Test213(val v1: One, val v2: Two, val v3: Three) : Two by v2, One by v1, Three by v3 { }
@@ -0,0 +1,12 @@
interface A {
fun foo() {}
}
open class B(a: A) : A by a
class C(a: A): B(a), A {
}
fun b(c: C) {
c.foo();
}
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
interface One {
public open fun foo() : Int
private fun boo() = 10
}
interface Two {
public open fun foo() : Int
}
interface OneImpl : One {
public override fun foo() = 1
}
interface TwoImpl : Two {
public override fun foo() = 2
}
class Test1() : TwoImpl, OneImpl {}
class Test2(a : One) : One by a, Two {}
class Test3(a : One, b : Two) : Two by b, One by a {}
@@ -0,0 +1,10 @@
interface A {
fun foo() {}
}
interface B : A {}
class C(b : B) : B by b {
}
@@ -0,0 +1,56 @@
// !WITH_NEW_INFERENCE
open class Final {
fun foo() {}
val bar: Int = 0
var qux: Int = 0
}
open class Derived : Final()
interface IFoo {
fun foo()
}
class CFoo : IFoo {
override fun foo() {}
}
interface IBar {
val bar: Int
}
class CBar : IBar {
override val bar: Int get() = 0
}
interface IQux {
val qux: Int
}
class CQux : IQux {
override val qux: Int get() = 0
}
interface IBarT<T> {
val bar: T
}
class CBarT<T> : IBarT<T> {
override val bar: T get() = null!!
}
class Test1 : Final(), IFoo by CFoo()
class Test2 : Final(), IBar by CBar()
class Test3 : Final(), IQux by CQux()
class Test4 : Derived(), IFoo by CFoo()
class Test5 : Derived(), IBar by CBar()
class Test6 : Derived(), IQux by CQux()
class Test7 : Final(), IBarT<Int> by CBarT<Int>()
class Test8 : Final(), IBarT<Int> by CBar()
@@ -0,0 +1,57 @@
interface IStr {
val foo: String
}
class CStr : IStr {
override val foo: String get() = ""
}
interface IInt {
val foo: Int
}
class CInt : IInt {
override val foo: Int get() = 42
}
interface IAny {
val foo: Any
}
class CAny : IAny {
override val foo: Any get() = null!!
}
interface IGeneric<T> {
val foo: T
}
class CGeneric<T> : IGeneric<T> {
override val foo: T get() = null!!
}
abstract class Test1 : IStr by CStr(), IInt
abstract class Test2 : IStr, IInt by CInt()
abstract class Test3 : IStr by CStr(), IInt by CInt()
abstract class Test4 : IStr by CStr(), IGeneric<String>
abstract class Test5 : IStr by CStr(), IGeneric<Any>
abstract class Test6 : IStr by CStr(), IGeneric<Int>
abstract class Test7 : IGeneric<String> by CGeneric<String>(), IStr
abstract class Test8 : IGeneric<String> by CGeneric<String>(), IInt
// Can't test right now due to https://youtrack.jetbrains.com/issue/KT-10258
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
abstract class Test10 : IInt by CInt(), IStr by CStr(), IAny by CAny()
abstract class Test11 : IInt, IStr by CStr(), IAny by CAny()
abstract class Test12 : IInt, IStr, IAny by CAny()
@@ -0,0 +1,59 @@
interface IStr {
fun foo(): String
}
class CStr : IStr {
override fun foo(): String = ""
}
interface IInt {
fun foo(): Int
}
class CInt : IInt {
override fun foo(): Int = 42
}
interface IAny {
fun foo(): Any
}
class CAny : IAny {
override fun foo(): Any = null!!
}
interface IGeneric<T> {
fun foo(): T
}
class CGeneric<T> : IGeneric<T> {
override fun foo(): T {
throw UnsupportedOperationException()
}
}
abstract class Test1 : IStr by CStr(), IInt
abstract class Test2 : IStr, IInt by CInt()
abstract class Test3 : IStr by CStr(), IInt by CInt()
abstract class Test4 : IStr by CStr(), IGeneric<String>
abstract class Test5 : IStr by CStr(), IGeneric<Any>
abstract class Test6 : IStr by CStr(), IGeneric<Int>
abstract class Test7 : IGeneric<String> by CGeneric<String>(), IStr
abstract class Test8 : IGeneric<String> by CGeneric<String>(), IInt
// Can't test due to https://youtrack.jetbrains.com/issue/KT-10258
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
abstract class Test10 : IInt by CInt(), IStr by CStr(), IAny by CAny()
abstract class Test11 : IInt, IStr by CStr(), IAny by CAny()
abstract class Test12 : IInt, IStr, IAny by CAny()
@@ -0,0 +1,29 @@
interface IVar {
var foo: Int
}
interface IDerived : IVar
interface IVal {
val foo: Int
}
class CVal : IVal {
override val foo: Int get() = 42
}
interface IValT<T> {
val foo: T
}
class CValT<T> : IValT<T> {
override val foo: T get() = null!!
}
abstract class Test1 : IVar, IVal by CVal()
abstract class Test2 : IVar, IValT<Int> by CValT<Int>()
abstract class Test3 : IDerived, IVal by CVal()
abstract class Test4 : IDerived, IValT<Int> by CValT<Int>()
@@ -0,0 +1,19 @@
interface IBase1 {
fun foo(): Any
}
open class IDerived1 : IBase1 {
override fun foo(): String = "1"
}
class Broken1(val b: IBase1) : IBase1 by b, IDerived1()
interface IBase2 {
val foo: Any
}
open class IDerived2 : IBase2 {
override val foo: String = "2"
}
class Broken2(val b: IBase2) : IBase2 by b, IDerived2()
@@ -0,0 +1,19 @@
interface IBase1 {
fun foo(): Any
}
interface IDerived1 {
fun foo(): String
}
class Broken1(val b: IBase1) : IBase1 by b, IDerived1
interface IBase2 {
val foo: Any
}
interface IDerived2 {
val foo: String
}
class Broken2(val b: IBase2) : IBase2 by b, IDerived2
@@ -0,0 +1,17 @@
interface IA {
fun foo(): Number
}
interface IB : IA {
override fun foo(): Int
}
object AImpl : IA {
override fun foo() = 42
}
open class C : IA by AImpl, IB
class D : C() {
override fun foo(): Double = 3.14
}
@@ -0,0 +1,19 @@
interface IBase1 {
fun foo(): Any
}
interface IDerived1 : IBase1 {
override fun foo(): String
}
class Broken1(val b: IBase1) : IBase1 by b, IDerived1
interface IBase2 {
val foo: Any
}
interface IDerived2 : IBase2 {
override val foo: String
}
class Broken2(val b: IBase2) : IBase2 by b, IDerived2
@@ -0,0 +1,11 @@
interface A<T> {
fun foo()
}
interface B<T> : A<T> {
fun bar()
}
class BImpl<T>(a: A<T>) : B<T>, A<T> by a {
override fun bar() { throw UnsupportedOperationException() }
}
@@ -0,0 +1,18 @@
public interface Base {
fun test() = "OK"
}
abstract class Impl : Base {
override abstract fun test(): String
}
class Delegate : Base
fun box(): String {
object : Impl(), Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,19 @@
public interface Base {
fun test() = "OK"
}
public interface Base2 : Base
class Delegate : Base2
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,20 @@
public interface Base {
val test: String
get() = "OK"
}
public interface Base2 : Base
class Delegate : Base2
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,19 @@
public interface Base {
fun test() = "OK"
}
public interface Base2 : Base {
override fun test() = "OK2"
}
class Delegate : Base2
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,26 @@
public interface Base {
var test: String
get() = "OK"
set(s: String) {
}
}
public interface Base2 : Base {
override var test: String
get() = "OK2"
set(value) {}
}
class Delegate : Base2 {
}
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,43 @@
public interface Base {
fun test() = "Base"
}
public interface Base2 : Base {
override fun test() = "Base2"
}
public interface Base3 : Base {
override fun test() = "Base3"
}
class Impl : Base
class Impl2 : Base2
class Impl3 : Base3
class ImplAll : Base, Base2, Base3 {
override fun test(): String {
return super<Base2>.test()
}
}
fun box(): String {
object : Base2, Base3, Base by Impl() {
}
object : Base2 by Impl2(), Base3, Base {
}
object : Base2, Base3 by Impl3(), Base {
}
object : Base2 by Impl2(), Base3 by Impl3(), Base by Impl() {
}
return "OK"
}
@@ -0,0 +1,18 @@
public interface Base {
fun test() = "OK"
}
open class Base2 : Base {
override fun test() = "OK2"
}
class Delegate : Base
fun box(): String {
object : Base2(), Base by Delegate() {
override fun test() = "OK"
}
return "OK"
}
@@ -0,0 +1,13 @@
interface Base {
fun test() = "Base"
}
class Delegate : Base
abstract class Middle : Base {
override fun test() = "MyClass"
}
abstract class MyClass : Middle()
class A : MyClass(), Base by Delegate()
@@ -0,0 +1,14 @@
public interface Base<T> {
fun test(p: T) = "Base"
}
public interface Derived<Y> : Base<Y>
class Delegate<Z> : Derived<Z>
fun box(): String {
object : Derived<String> by Delegate() {
}
return "OK"
}
@@ -0,0 +1,16 @@
public interface Base {
fun test() = "Base"
}
class Delegate : Base {
override fun test() = "Base"
}
public open class MyClass : Base by Delegate()
fun box(): String {
object : MyClass(), Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,21 @@
public interface Base {
fun test() = "Base"
}
public interface Derived : Base {
override fun test() = "Derived"
}
class Delegate : Derived {
override fun test() = "Delegate"
}
public open class MyClass : Base by Delegate()
fun box(): String {
object : MyClass(), Derived by Delegate() {
}
return "OK"
}
@@ -0,0 +1,28 @@
// !WITH_NEW_INFERENCE
interface Base1 {
fun test() = "OK"
}
interface Base2 {
fun test2() = "OK"
}
class Delegate1 : Base1
class Delegate2 : Base2
public abstract class MyClass : Base1, Base2 {
override fun test(): String {
return "Class"
}
override fun test2(): String {
return "Class"
}
}
class A : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() {
}
@@ -0,0 +1,19 @@
public interface Base {
fun getValue(): String
fun test() = getValue()
}
class Delegate : Base {
override fun getValue() = "Delegate"
}
public abstract class MyClass : Base {
override fun test(): String {
return "Class"
}
}
class A : MyClass(), Base by Delegate() {
override fun getValue() = "Delegate"
}
@@ -0,0 +1,15 @@
interface Base {
fun test() = "OK"
}
open class Base2 : Base
class Delegate : Base
fun box(): String {
object : Base2(), Base by Delegate() {
}
return "OK"
}
@@ -0,0 +1,17 @@
public interface Base {
val test: String
get() = "OK"
}
open class Delegate : Base {
override val test: String
get() = "OK"
}
fun box(): String {
object : Delegate(), Base by Delegate() {
}
return "OK"
}