FIR: skip return insertion for lambda w/ Unit return type

This commit is contained in:
Jinseong Jeon
2020-08-20 23:41:09 -07:00
committed by Mikhail Glukhikh
parent f1ce668ede
commit ca541337d1
27 changed files with 52 additions and 55 deletions
@@ -6,7 +6,7 @@ FILE: lambdas.kt
when () {
(R|<local>/x| is R|kotlin/Int|) -> {
R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^ R|<local>/x|.R|kotlin/Int.inc|()
R|<local>/x|.R|kotlin/Int.inc|()
}
)
}
@@ -9,7 +9,7 @@ FILE: lambda.kt
}
public final fun main(): R|kotlin/Unit| {
R|/foo|(<L> = foo@fun <anonymous>(): R|kotlin/Unit| {
^ String(This is test)
String(This is test)
}
)
R|/bar|(<L> = bar@fun <anonymous>(): R|kotlin/String| {
@@ -35,7 +35,7 @@ FILE: lambdaWithReceiver.kt
R|/complexLambda|(<L> = complexLambda@fun R|kotlin/Int|.<anonymous>(it: R|kotlin/String|): R|kotlin/Unit| {
this@R|special/anonymous|.R|kotlin/Int.inc|()
this@R|special/anonymous|.R|kotlin/Int.inc|()
^ R|<local>/it|.R|kotlin/String.length|
R|<local>/it|.R|kotlin/String.length|
}
)
}
@@ -9,13 +9,13 @@ FILE: lambdaInElvis.kt
}
public final fun bar1(w: R|kotlin/collections/List<kotlin/CharSequence>|): R|kotlin/collections/List<kotlin/CharSequence>?| {
^bar1 R|/foo|<R|kotlin/CharSequence|>(<L> = foo@fun <anonymous>(container: R|kotlin/collections/MutableList<kotlin/CharSequence>|): R|kotlin/Unit| {
^ R|<local>/container|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
R|<local>/container|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
}
) ?: R|<local>/w|
}
public final fun bar2(): R|kotlin/collections/List<kotlin/CharSequence>?| {
^bar2 R|/foo|<R|kotlin/CharSequence|>(<L> = foo@fun <anonymous>(container: R|kotlin/collections/MutableList<kotlin/CharSequence>|): R|kotlin/Unit| {
^ R|<local>/container|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
R|<local>/container|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
}
) ?: R|/listOf|<R|kotlin/CharSequence|>()
}
@@ -7,7 +7,7 @@ FILE: complexLambdaWithTypeVariableAsExpectedType.kt
}
public final fun test(): R|kotlin/Unit| {
R|/select|<R|(kotlin/Int) -> kotlin/Unit|>(R|/id|<R|(kotlin/Int) -> kotlin/Int|>(<L> = id@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Int| {
^ R|<local>/it|.R|kotlin/Int.inv|()
R|<local>/it|.R|kotlin/Int.inv|()
}
), R|/id|<R|(kotlin/Int) -> kotlin/Unit|>(<L> = id@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| {
^@id Unit
@@ -1,11 +1,11 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
Q|JavaClass|.R|/JavaClass.foo|(<L> = foo@fun <anonymous>(): R|kotlin/Unit| {
^ String()
String()
}
)
R|/JavaClass.JavaClass|().R|/JavaClass.bar|(<L> = bar@fun <anonymous>(): R|kotlin/Unit| {
^ String()
String()
}
)
}
@@ -21,7 +21,7 @@ FILE: safeCalls.kt
}
public final fun test_3(x: R|kotlin/Any|): R|kotlin/Unit| {
(R|<local>/x| as? R|A|)?.{ $subj$.R|/A.bar|(R|<local>/x|) }?.{ $subj$.R|/foo|(R|<local>/x|.R|/A.bool|()) }?.{ $subj$.R|/let|(<L> = let@fun <anonymous>(): R|kotlin/Unit| {
^ R|<local>/x|.R|/A.bool|()
R|<local>/x|.R|/A.bool|()
}
) }
R|<local>/x|.<Unresolved name: bool>#()