Add various tests for DFA testing
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
annotation class RetentionSourceAndTargetExpression
|
||||
+56
-4
@@ -5,12 +5,28 @@ class Class {
|
||||
val prop_4: Float? = 3f
|
||||
val prop_5: Float = 3f
|
||||
val prop_6: String = "..."
|
||||
val prop_7: Nothing? = "..."
|
||||
val prop_7: Nothing? = null
|
||||
val prop_8: Class? = null
|
||||
var prop_9: Boolean = true
|
||||
val prop_10: Number? = 3f
|
||||
val prop_11: Int = 10
|
||||
var prop_12: String = ""
|
||||
val prop_13: Any? = ""
|
||||
val prop_14: Comparable<*>? = ""
|
||||
val prop_15: Iterable<*>? = ""
|
||||
|
||||
fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }}
|
||||
fun fun_2(value_1: Int): Int = value_1 * 2
|
||||
fun fun_3(value_1: Int): (Int) -> Int = fun(value_2: Int): Int = value_1 * value_2 * 2
|
||||
fun fun_4(): Class? = Class()
|
||||
|
||||
operator fun get(i1: Int, i2: Int) = 10
|
||||
operator fun set(i1: Int, i2: Int, el: Int) {}
|
||||
operator fun get(i1: Int) = 10
|
||||
operator fun set(i1: Int, el: Int) {}
|
||||
operator fun invoke() {}
|
||||
operator fun invoke(x) = { x: Any -> x }
|
||||
operator fun invoke(x: Any, y: Any) {}
|
||||
operator fun contains(a: Int) = a > 30
|
||||
operator fun contains(a: Long) = a > 30L
|
||||
operator fun contains(a: Char) = a > 30.toChar()
|
||||
@@ -19,12 +35,24 @@ class Class {
|
||||
fun getLongArray() = longArrayOf(1L, 2L, 3L, 4L, 5L)
|
||||
fun getCharArray() = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), 4.toChar(), 5.toChar())
|
||||
|
||||
class _NestedClass {
|
||||
class NestedClass {
|
||||
val prop_4 = 4
|
||||
val prop_5 = 5
|
||||
}
|
||||
}
|
||||
|
||||
operator fun Class?.inc(): Class? = null
|
||||
operator fun Class?.dec(): Class? = null
|
||||
operator fun Class?.plus(x: Class?): Class? = null
|
||||
operator fun Class?.minus(x: Class?): Class? = null
|
||||
|
||||
open class ClassWithCustomEquals {
|
||||
override fun equals(other: Any?) = true
|
||||
}
|
||||
|
||||
open class ClassWithCostructorParam(val x: Any)
|
||||
open class ClassWithCostructorTwoParams(val x: Any, val y: Any)
|
||||
|
||||
class EmptyClass {}
|
||||
|
||||
class ClassWithCompanionObject {
|
||||
@@ -37,6 +65,15 @@ open class ClassLevel1 {
|
||||
open class ClassLevel2: ClassLevel1() {
|
||||
fun test2() {}
|
||||
}
|
||||
open class ClassLevel21: ClassLevel1() {
|
||||
fun test21() {}
|
||||
}
|
||||
open class ClassLevel22: ClassLevel1() {
|
||||
fun test22() {}
|
||||
}
|
||||
open class ClassLevel23: ClassLevel1() {
|
||||
fun test23() {}
|
||||
}
|
||||
open class ClassLevel3: ClassLevel2() {
|
||||
fun test3() {}
|
||||
}
|
||||
@@ -51,6 +88,11 @@ class ClassLevel6: ClassLevel5() {
|
||||
}
|
||||
|
||||
class Inv<T>(val x: T = null as T) {
|
||||
val prop_1: Inv<T>? = null
|
||||
val prop_2: T? = null
|
||||
val prop_3: T = null
|
||||
val prop_4 = 10
|
||||
|
||||
fun test() {}
|
||||
fun get() = x
|
||||
fun put(x: T) {}
|
||||
@@ -63,6 +105,9 @@ class In<in T>() {
|
||||
}
|
||||
|
||||
class Out<out T>(val x: T = null as T) {
|
||||
val prop_1: Inv<T>? = null
|
||||
val prop_2: T? = null
|
||||
|
||||
fun get() = x
|
||||
}
|
||||
|
||||
@@ -71,10 +116,17 @@ open class ClassWithTwoTypeParameters<K, L> {
|
||||
fun test2(): K? { return null }
|
||||
}
|
||||
|
||||
class ClassWithThreeTypeParameters<K, L, M>(
|
||||
open class ClassWithThreeTypeParameters<K, L, M>(
|
||||
val x: K,
|
||||
val y: L,
|
||||
val z: M
|
||||
)
|
||||
|
||||
class ClassWithSixTypeParameters<K, in L, out M, O, in P, out R>
|
||||
open class ClassWithSixTypeParameters<K, in L, out M, O, in P, out R>(
|
||||
val u: R,
|
||||
val x: K,
|
||||
val y: M,
|
||||
val z: O
|
||||
) {
|
||||
fun test() = 10
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enum class EnumClass {
|
||||
NORTH, SOUTH, WEST, EAST
|
||||
NORTH, SOUTH, WEST, EAST;
|
||||
|
||||
fun fun_1() {}
|
||||
}
|
||||
|
||||
enum class EnumClassSingle {
|
||||
|
||||
@@ -17,3 +17,12 @@ fun <K> expandInWithRemoveNullable(vararg x: In<K?>): K = x[0] as K
|
||||
fun <K> expandOutWithRemoveNullable(vararg x: Out<K?>): K = x[0] as K
|
||||
|
||||
fun <K> removeNullable(vararg x: K?): K = x as K
|
||||
|
||||
fun <T> T.funT() = 10
|
||||
fun <T> T?.funNullableT = 10
|
||||
|
||||
fun Any.funAny() = 10
|
||||
fun Any?.funNullableAny = 10
|
||||
|
||||
|
||||
fun funNothingQuest() = null
|
||||
@@ -3,11 +3,21 @@ interface EmptyInterface
|
||||
interface Interface1 {
|
||||
fun itest() {}
|
||||
fun itest1() {}
|
||||
fun itest0(): String
|
||||
fun itest00(): Interface1
|
||||
fun itest000(): Int?
|
||||
fun itest0000(): Int
|
||||
fun itest00000(): Int
|
||||
}
|
||||
|
||||
interface Interface2 {
|
||||
fun itest() {}
|
||||
fun itest2() {}
|
||||
fun itest0(): CharSequence
|
||||
fun itest00(): Interface2
|
||||
fun itest000(): Nothing?
|
||||
fun itest0000(): Nothing
|
||||
fun itest00000(): String
|
||||
}
|
||||
|
||||
interface Interface3 {
|
||||
|
||||
@@ -17,6 +17,7 @@ object DeepObject {
|
||||
object G {
|
||||
object J {
|
||||
val x: Int? = 10
|
||||
val prop_1: Int? = 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,3 +14,17 @@ val anonymousTypeProperty = object {}
|
||||
val nullableAnonymousTypeProperty = if (true) object {} else null
|
||||
|
||||
val nullableOut: Out<Int>? = null
|
||||
|
||||
val <T> T.propT get() = 10
|
||||
|
||||
val <T : Any> T.propDefNotNullT get() = 10
|
||||
|
||||
val <T> T?.propNullableT get(): Int? = 10
|
||||
|
||||
val <T> T.propTT get() = 10 as T
|
||||
|
||||
val <T> T?.propNullableTT get() = 10 as T?
|
||||
|
||||
val Any.propAny get() = 10
|
||||
|
||||
val Any?.propNullableAny get() = 10
|
||||
@@ -27,10 +27,12 @@ class SealedWithMethodsChild3() : SealedClassWithMethods() {
|
||||
fun m3() = this.hashCode().toString()
|
||||
}
|
||||
|
||||
sealed class SealedClassMixed
|
||||
sealed class SealedClassMixed {
|
||||
val prop_1: Int? = 10
|
||||
}
|
||||
data class SealedMixedChild1(val number: Int) : SealedClassMixed()
|
||||
data class SealedMixedChild2(val e1: Int, val e2: Int) : SealedClassMixed()
|
||||
data class SealedMixedChild3(val m1: Int, val m2: Int) : SealedClassMixed()
|
||||
object SealedMixedChildObject1 : SealedClassMixed()
|
||||
object SealedMixedChildObject1 : SealedClassMixed() { val prop_2: Int? = 10 }
|
||||
object SealedMixedChildObject2 : SealedClassMixed()
|
||||
object SealedMixedChildObject3 : SealedClassMixed()
|
||||
Reference in New Issue
Block a user