[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,110 @@
FILE: when.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
}
public abstract interface B : R|kotlin/Any| {
public abstract fun bar(): R|kotlin/Unit|
}
public final fun test_1(x: R|kotlin/Any?|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) -> {
R|<local>/x|.R|/A.foo|()
}
(R|<local>/x| is R|B|) -> {
R|<local>/x|.R|/B.bar|()
}
}
when () {
(R|<local>/x| !is R|A|) -> {
}
(R|<local>/x| !is R|B|) -> {
R|<local>/x|.R|/A.foo|()
}
(R|<local>/x| is R|kotlin/Int|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
R|<local>/x|.R|kotlin/Int.inc|()
}
else -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
}
}
}
public final fun test_2(x: R|kotlin/Any?|): R|kotlin/Unit| {
when (R|<local>/x|) {
($subj$ is R|A|) -> {
R|<local>/x|.R|/A.foo|()
}
($subj$ is R|B|) -> {
R|<local>/x|.R|/B.bar|()
}
}
when (R|<local>/x|) {
($subj$ !is R|A|) -> {
}
($subj$ !is R|B|) -> {
R|<local>/x|.R|/A.foo|()
}
($subj$ is R|kotlin/Int|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
R|<local>/x|.R|kotlin/Int.inc|()
}
else -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
}
}
}
public final fun test_3(x: R|kotlin/Any?|): R|kotlin/Unit| {
when (lval y: R|kotlin/Any?| = R|<local>/x|) {
($subj$ is R|A|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/y|.R|/A.foo|()
}
($subj$ is R|B|) -> {
R|<local>/x|.R|/B.bar|()
R|<local>/y|.R|/B.bar|()
}
}
when (lval y: R|kotlin/Any?| = R|<local>/x|) {
($subj$ !is R|A|) -> {
}
($subj$ !is R|B|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/y|.R|/A.foo|()
}
($subj$ is R|kotlin/Int|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
R|<local>/x|.R|kotlin/Int.inc|()
R|<local>/y|.R|/A.foo|()
R|<local>/y|.R|/B.bar|()
R|<local>/y|.R|kotlin/Int.inc|()
}
else -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
R|<local>/y|.R|/A.foo|()
R|<local>/y|.R|/B.bar|()
}
}
}
public final fun test_4(x: R|kotlin/Any|): R|kotlin/Unit| {
when ((R|<local>/x| as R|kotlin/Int|)) {
==($subj$, Int(1)) -> {
R|<local>/x|.R|kotlin/Int.inc|()
}
}
R|<local>/x|.R|kotlin/Int.inc|()
}