[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Foo(val x: Int)
|
||||
|
||||
inline interface InlineInterface
|
||||
inline annotation class InlineAnn
|
||||
inline object InlineObject
|
||||
inline enum class InlineEnum
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: -InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class Foo(val x: Int)
|
||||
|
||||
inline annotation class InlineAnn
|
||||
inline object InlineObject
|
||||
inline enum class InlineEnum
|
||||
|
||||
inline class NotVal(x: Int)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class X(val x: Int)
|
||||
inline class Z(val x: Int)
|
||||
|
||||
class TestOk1(val a: Int, val b: Int) {
|
||||
constructor(x: X) : this(x.x, 1)
|
||||
}
|
||||
|
||||
class TestErr1(val a: Int) {
|
||||
constructor(x: X) : this(x.x)
|
||||
}
|
||||
|
||||
class TestErr2(val a: Int, val b: Int) {
|
||||
constructor(x: X) : this(x.x, 1)
|
||||
constructor(z: Z) : this(z.x, 2)
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
class Val {
|
||||
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
|
||||
}
|
||||
|
||||
class Var {
|
||||
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
|
||||
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
|
||||
}
|
||||
|
||||
|
||||
object ValObject {
|
||||
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
|
||||
}
|
||||
|
||||
object VarObject {
|
||||
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
|
||||
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
|
||||
}
|
||||
|
||||
inline class Z(val data: Int) {
|
||||
val testVal by Val()
|
||||
var testVar by Var()
|
||||
|
||||
val testValBySingleton by ValObject
|
||||
var testVarBySingleton by VarObject
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class X(val x: Int)
|
||||
inline class Z(val x: Int)
|
||||
inline class Str(val str: String)
|
||||
inline class Name(val name: String)
|
||||
inline class NStr(val str: String?)
|
||||
|
||||
fun testSimple(x: X) {}
|
||||
fun testSimple(z: Z) {}
|
||||
|
||||
fun testMixed(x: Int, y: Int) {}
|
||||
fun testMixed(x: X, y: Int) {}
|
||||
fun testMixed(x: Int, y: X) {}
|
||||
fun testMixed(x: X, y: X) {}
|
||||
|
||||
fun testNewType(s: Str) {}
|
||||
fun testNewType(name: Name) {}
|
||||
|
||||
fun testNullableVsNonNull1(s: Str) {}
|
||||
fun testNullableVsNonNull1(s: Str?) {}
|
||||
|
||||
fun testNullableVsNonNull2(ns: NStr) {}
|
||||
fun testNullableVsNonNull2(ns: NStr?) {}
|
||||
|
||||
fun testFunVsExt(x: X) {}
|
||||
fun X.testFunVsExt() {}
|
||||
|
||||
fun testNonGenericVsGeneric(x: X, y: Number) {}
|
||||
fun <T : Number> testNonGenericVsGeneric(x: X, y: T) {}
|
||||
|
||||
class C<TC : Number> {
|
||||
fun testNonGenericVsGeneric(x: X, y: Number) {}
|
||||
fun <T : Number> testNonGenericVsGeneric(x: X, y: T) {}
|
||||
fun testNonGenericVsGeneric(x: X, y: TC) {}
|
||||
}
|
||||
compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.fir.kt
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Name(val name: String)
|
||||
inline class Password(val password: String)
|
||||
|
||||
interface NameVerifier {
|
||||
fun verify(name: Name)
|
||||
}
|
||||
|
||||
interface PasswordVerifier {
|
||||
fun verify(password: Password)
|
||||
}
|
||||
|
||||
interface NameAndPasswordVerifier : NameVerifier, PasswordVerifier
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
inline class Foo(val x: Int)
|
||||
inline class Bar(val y: String)
|
||||
|
||||
fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) {
|
||||
val a1 = f1 === f2 || f1 !== f2
|
||||
val a2 = f1 === f1
|
||||
val a3 = f1 === b1 || f1 !== b1
|
||||
|
||||
val c1 = fn1 === fn2 || fn1 !== fn2
|
||||
val c2 = f1 === fn1 || f1 !== fn1
|
||||
val c3 = b1 === fn1 || b1 !== fn1
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
abstract class AbstractBaseClass
|
||||
|
||||
open class OpenBaseClass
|
||||
|
||||
interface BaseInterface
|
||||
|
||||
inline class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass()
|
||||
|
||||
inline class TestExtendsOpenClass(val x: Int) : OpenBaseClass()
|
||||
|
||||
inline class TestImplementsInterface(val x: Int) : BaseInterface
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
interface IFoo
|
||||
|
||||
object FooImpl : IFoo
|
||||
|
||||
inline class Test1(val x: Any) : IFoo by FooImpl
|
||||
|
||||
inline class Test2(val x: IFoo) : IFoo by x
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Test(val x: Int = 42)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class A0(val x: Int)
|
||||
|
||||
inline class A1
|
||||
inline class A2()
|
||||
inline class A3(x: Int)
|
||||
inline class A4(var x: Int)
|
||||
inline class A5(val x: Int, val y: Int)
|
||||
inline class A6(x: Int, val y: Int)
|
||||
inline class A7(vararg val x: Int)
|
||||
inline class A8(open val x: Int)
|
||||
inline class A9(final val x: Int)
|
||||
|
||||
class B1 {
|
||||
companion object {
|
||||
inline class C1(val x: Int)
|
||||
}
|
||||
|
||||
inline class C2(val x: Int)
|
||||
}
|
||||
|
||||
object B2 {
|
||||
inline class C3(val x: Int)
|
||||
}
|
||||
|
||||
final inline class D0(val x: Int)
|
||||
open inline class D1(val x: Int)
|
||||
abstract inline class D2(val x: Int)
|
||||
sealed inline class D3(val x: Int)
|
||||
|
||||
inline data class D4(val x: String)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class UInt(val x: Int)
|
||||
|
||||
inline class UIntArray(private val storage: IntArray) : Collection<UInt> {
|
||||
public override val size: Int get() = storage.size
|
||||
|
||||
override operator fun iterator() = TODO()
|
||||
override fun contains(element: UInt): Boolean = TODO()
|
||||
override fun containsAll(elements: Collection<UInt>): Boolean = TODO()
|
||||
override fun isEmpty(): Boolean = TODO()
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Foo<T>(val x: T)
|
||||
inline class FooNullable<T>(val x: T?)
|
||||
|
||||
inline class FooGenericArray<T>(val x: Array<T>)
|
||||
inline class FooGenericArray2<T>(val x: Array<Array<T>>)
|
||||
|
||||
inline class FooStarProjectedArray(val x: Array<*>)
|
||||
inline class FooStarProjectedArray2(val x: Array<Array<*>>)
|
||||
|
||||
inline class Bar(val u: Unit)
|
||||
inline class BarNullable(val u: Unit?)
|
||||
|
||||
inline class Baz(val u: Nothing)
|
||||
inline class BazNullable(val u: Nothing?)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
inline class MyInt(val x: Int)
|
||||
inline class MyString(val x: String)
|
||||
|
||||
annotation class Ann1(val a: MyInt)
|
||||
annotation class Ann2(val a: Array<MyString>)
|
||||
annotation class Ann3(vararg val a: MyInt)
|
||||
|
||||
annotation class Ann4(val a: KClass<MyInt>)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
inline class Foo(val x: Int)
|
||||
|
||||
lateinit var a: Foo
|
||||
|
||||
fun foo() {
|
||||
lateinit var b: Foo
|
||||
}
|
||||
compiler/testData/diagnostics/tests/inlineClasses/presenceOfInitializerBlockInsideInlineClass.fir.kt
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
inline class Foo(val x: Int) {
|
||||
init {}
|
||||
|
||||
init {
|
||||
val f = 1
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class ConstructorWithDefaultVisibility(val x: Int)
|
||||
inline class PublicConstructor public constructor(val x: Int)
|
||||
inline class InternalConstructor internal constructor(val x: Int)
|
||||
inline class ProtectedConstructor protected constructor(val x: Int)
|
||||
inline class PrivateConstructor private constructor(val x: Int)
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface A {
|
||||
val goodSize: Int
|
||||
}
|
||||
|
||||
interface B {
|
||||
val badSize: Int
|
||||
}
|
||||
|
||||
inline class Foo(val x: Int) : A, B {
|
||||
val a0
|
||||
get() = 0
|
||||
|
||||
val a1 = 0
|
||||
|
||||
var a2: Int
|
||||
get() = 1
|
||||
set(value) {}
|
||||
|
||||
var a3: Int = 0
|
||||
get() = 1
|
||||
set(value) {
|
||||
field = value
|
||||
}
|
||||
|
||||
override val goodSize: Int
|
||||
get() = 0
|
||||
|
||||
override val badSize: Int = 0
|
||||
|
||||
lateinit var lateinitProperty: String
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Test1(val x: Test1)
|
||||
|
||||
inline class Test2A(val x: Test2B)
|
||||
inline class Test2B(val x: Test2A)
|
||||
|
||||
inline class Test3A(val x: Test3B)
|
||||
inline class Test3B(val x: Test3C)
|
||||
inline class Test3C(val x: Test3A)
|
||||
|
||||
inline class TestNullable(val x: TestNullable?)
|
||||
|
||||
inline class TestRecursionInTypeArguments(val x: List<TestRecursionInTypeArguments>)
|
||||
|
||||
inline class TestRecursionInArray(val x: Array<TestRecursionInArray>)
|
||||
|
||||
inline class TestRecursionInUpperBounds<T : TestRecursionInUpperBounds<T>>(val x: T)
|
||||
|
||||
inline class Id<T>(val x: T)
|
||||
inline class TestRecursionThroughId(val x: Id<TestRecursionThroughId>)
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class IC1(val x: Any) {
|
||||
fun box() {}
|
||||
fun box(x: Any) {}
|
||||
|
||||
fun unbox() {}
|
||||
fun unbox(x: Any) {}
|
||||
|
||||
override fun equals(other: Any?): Boolean = true
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
|
||||
inline class IC2(val x: Any) {
|
||||
fun box(x: Any) {}
|
||||
fun box(): Any = TODO()
|
||||
|
||||
fun unbox(x: Any) {}
|
||||
fun unbox(): Any = TODO()
|
||||
|
||||
fun equals(my: Any, other: Any): Boolean = true
|
||||
fun hashCode(a: Any): Int = 0
|
||||
}
|
||||
|
||||
inline class IC3(val x: Any) {
|
||||
fun box(x: Any): Any = TODO()
|
||||
fun unbox(x: Any): Any = TODO()
|
||||
|
||||
fun equals(): Boolean = true
|
||||
}
|
||||
|
||||
interface WithBox {
|
||||
fun box(): String
|
||||
}
|
||||
|
||||
inline class IC4(val s: String) : WithBox {
|
||||
override fun box(): String = ""
|
||||
}
|
||||
|
||||
inline class IC5(val a: String) {
|
||||
constructor(i: Int) : this(i.toString()) {
|
||||
TODO("something")
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
val u1 = 1u
|
||||
val u2 = 0xFu
|
||||
val u3 = 0b1u
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
inline class Foo(val x: Int)
|
||||
|
||||
fun f1(vararg a: Foo) {}
|
||||
fun f2(vararg a: Foo?) {}
|
||||
|
||||
class A {
|
||||
fun f3(a0: Int, vararg a1: Foo) {
|
||||
fun f4(vararg a: Foo) {}
|
||||
|
||||
val g = fun (vararg v: Foo) {}
|
||||
}
|
||||
}
|
||||
|
||||
class B(vararg val s: Foo) {
|
||||
constructor(a: Int, vararg s: Foo) : this(*s)
|
||||
}
|
||||
|
||||
annotation class Ann(vararg val f: Foo)
|
||||
Reference in New Issue
Block a user