[FIR-TEST] Move analysis tests to separate module

This commit is contained in:
Dmitriy Novozhilov
2020-03-18 15:10:46 +03:00
parent 3a479d5d16
commit cc07ae96b3
1477 changed files with 1001 additions and 980 deletions
@@ -0,0 +1,56 @@
/*
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-37081
*/
enum class A {
A1,
A2,
}
class B()
class C(val b : B)
fun get(f: Boolean) = if (f) {A.A1} else {""}
fun case2() {
val flag: Any = get(false) //string
val l1 = when (flag!!) { // should be NO_ELSE_IN_WHEN
A.A1 -> B()
A.A2 -> B()
}
val l2 = when (flag) {// should be NO_ELSE_IN_WHEN
A.A1 -> B()
A.A2 -> B()
}
}
fun case2() {
val flag: Any = get(true) //A
val l1 = when (flag!!) {// should be NO_ELSE_IN_WHEN
A.A1 -> B()
A.A2 -> B()
}
val l2 = when (flag) {// should be NO_ELSE_IN_WHEN
A.A1 -> B()
A.A2 -> B()
}
}
fun case3() {
val flag = "" //A
val l1 = when (flag!!) {// should be NO_ELSE_IN_WHEN
A.A1 -> B() //should be INCOMPATIBLE_TYPES
A.A2 -> B() //should be INCOMPATIBLE_TYPES
}
val l2 = when (flag) {// should be NO_ELSE_IN_WHEN
A.A1 -> B() //should be INCOMPATIBLE_TYPES
A.A2 -> B() //should be INCOMPATIBLE_TYPES
}
}