[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,110 @@
// !DIAGNOSTICS:-UNUSED_VARIABLE,-CAST_NEVER_SUCCEEDS,-DIVISION_BY_ZERO
import kotlin.reflect.KProperty
const val topLevel: Int = 0
const val topLevelInferred = 1
const var topLeveLVar: Int = 2
private val privateTopLevel = 3
object A {
const val inObject: Int = 4
}
class B(const val constructor: Int = 5)
abstract class C {
open const val x: Int = 6
abstract const val y: Int = 7
companion object {
const val inCompaionObject = 8
}
}
object D : C() {
override const val x: Int = 9
const val inObject = 10
final const val final = 11
const val withoutInitializer: Int
init {
withoutInitializer = 12
}
}
const val delegated: Int by Delegate()
const val withGetter: Int
get() = 13
const val withExplicitDefaultGetter: Int = 1
get
fun foo(): Int {
const val local: Int = 14
return 15
}
enum class MyEnum {
A {
const val inEnumEntry = 16
};
const val inEnum = 17
}
class Outer {
inner class Inner {
object C {
const val a = 18
}
}
}
const val defaultGetter = 19
get
const val nonConstInitializer1 = foo()
const val nonConstInitializer2 = 1 as String
const val nonConstInitializer3 = 1.0 as String
const val nonConstInitializer4 = 1 as Double
const val nonConstInitializer5 = "2" as Int
const val nonConstInitializer6 = 1/0
const val nonConstInitializer7 = -1/0
const val nonConstInitializer8 = 1/0 - 1/0
const val nonConstInitializer9 = 1.0/0.0 - 1/0
const val nonConstInitializer10 = 0/0
const val nonConstInitializer11 = 1 % 0
const val nonConstInitializer12 = 0 % 0
const val nonConstInitializer13 = 0.mod(0)
const val nonConstInitializer14 = 0.rem(0)
const val nonConstInitializer15 = 0.div(0)
const val constInitializer1 = 1.0/0
const val constInitializer2 = 1/0.0
const val constInitializer3 = 1.0/0.0
const val constInitializer4 = -1.0/0
const val constInitializer5 = 0.0/0
const val constInitializer6 = 42 + 1.0/0
const val constInitializer7 = 42 - 1.0/0
const val constInitializer8 = 1.0/0 - 1.0/0
const val constInitializer9 = 0.0/0 + 1.0/0
const val constInitializer10 = 1.0 % 0
const val constInitializer11 = 0.0 % 0
const val constInitializer12 = (-1.0) % 0
const val constInitializer13 = 1.0.rem(0)
const val constInitializer14 = 1.0.mod(0)
const val constInitializer15 = 1.0.div(0)
// ------------------
class Delegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): Int = 1
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: Int) = Unit
}
@@ -0,0 +1,3 @@
// !WITH_NEW_INFERENCE
annotation class A(val a: IntArray = arrayOf(1))
annotation class B(val a: IntArray = intArrayOf(1))
@@ -0,0 +1,18 @@
const val aConst = 1
const val bConst = aConst + 1
const val boolVal = bConst > 1 || (B.boolVal && A.boolVal)
const val stringInterpolation = "Result: ${B.boolVal}"
object A {
const val boolVal = bConst + 3 == 5
const val recursive1: Int = 1 + B.recursive2
}
class B {
companion object {
const val boolVal = A.boolVal
const val recursive2: Int = A.recursive1 + 2
}
}
@@ -0,0 +1,26 @@
// FILE: A.java
public class A {
public static final int X = 1;
public static final int Y;
public final int z = 3;
static {
Y = 2;
}
}
// FILE: main.kt
annotation class Ann(val x: Int)
@Ann(A.X)
fun main1() {}
@Ann(A.Y)
fun main2() {}
val q = A()
@Ann(q.z)
fun main3() {}
@@ -0,0 +1,15 @@
// FILE: A.java
public class A {
public static final String FOO = "foo";
}
// FILE: B.java
public class B extends A {
}
// FILE: main.kt
const val K1 = B.FOO
const val K2 = A.FOO
@@ -0,0 +1,19 @@
// FILE: Bar.java
public class Bar {
public static final int BAR = Foo.FOO + 1;
}
// FILE: Test.kt
class Foo {
companion object {
const val FOO = 1
}
}
class Baz {
companion object {
const val BAZ = Bar.BAR + 1
}
}
@@ -0,0 +1,19 @@
// FILE: Context.java
public interface Context {
String BEAN = "context";
}
// FILE: Test.kt
annotation class Resource(val name: String)
class MyController {
companion object {
private const val foo = Context.BEAN
}
@Resource(name = Context.BEAN)
fun setContext() {
}
}
@@ -0,0 +1,21 @@
// !LANGUAGE: -DivisionByZeroInConstantExpressions
// !DIAGNOSTICS:-DIVISION_BY_ZERO
const val a = 1 / 0.0
const val b = 1.0 / 0
const val c = 0.0 / 0
const val d = 1.0 % 0
const val e = 0.0 % 0
const val f = 0.0.mod(0)
const val g = 0.0.rem(0)
const val h = 0.0.div(0)
const val i = 1 / 0
val nonConst1 = 1.0 / 0
val nonConst2 = 1 / 0
val nonConst3 = 1.0 % 0
val nonConst4 = 1 % 0
val nonConst5 = 1.mod(0)
val nonConst6 = 1.rem(0)
val nonConst7 = 1.div(0)
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
const val intConst = 1
const val longConst: Long = 1
const val boolConst = true
const val stringConst = "empty"
enum class MyEnum { A }
const val enumConst: MyEnum = MyEnum.A
const val arrayConst: Array<String> = arrayOf("1")
const val intArrayConst: IntArray = intArrayOf()
const val unresolvedConst1 = <!UNRESOLVED_REFERENCE!>Unresolved<!>
const var unresolvedConst2 = <!UNRESOLVED_REFERENCE!>Unresolved<!>
const val unresolvedConst3 = <!UNRESOLVED_REFERENCE!>Unresolved<!>
get() = 10